french chraracters in browsers - browser

What is the solution to correctly display french characters in all browsers? now i get in some browsers this: (pr�sent�s)
Thanks.

One solution is to learn how to use Unicode.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Try UTF-8 encoding on all your pages and encoding all your strings to UTF-8.

You should specify a content type for the page, and specify what encoding you use for creating the page. Example:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

You need to select a character encoding for your page. In your editor, save to that encoding, and specify in the HTML <head> section:
<meta http-equiv="Content-Type" content="text/html; charset=The_Chosen_Encoding" />
Suitable encodings for French include ISO-8859-1 (aka Latin-1) and UTF-8.
Alternatively, you may stick to plain ASCII and use HTML entities for the accentuated letters, such as:
é for é
è for è
etc.

Just use this in you html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
and if you're using php additionally this in your php-script
header ('Content-type: text/html; charset=utf-8');

Related

Is it better for the robots to find html pages that do redirection or should I just use htaccess?

I want some of the pages to be redirected back to the main page as 'params'. These are not data or privacy sensitive, so I dont need to use the "session" variable.
I was thinking that it would be better for the robots to find physical html files. So for example, I have example.kiwi/downloads.html containing
<meta http-equiv=="refresh" content="0; url=https://example.kiwi?mode=downloads" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script>window.location.href = "https://example.kiwi?mode=downloads"</script>
I assume that I can do the same with htaccess. Is that better and how do I do it. Being a sensitive file, I am trying not to experiment a lot with it.

Twitter card not working

My meta tags for twitter in site:
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="....">
<meta property="twitter:title" content=".....">
<meta property="twitter:description" content="test description">
<meta property="twitter:image" content="....">
I even tried with twitter:image:url and also allowed twitter bot in robot.txt but no luck till now
Use name instead of property in you meta tags Like :
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="....">
<meta name="twitter:title" content=".....">
<meta name="twitter:description" content="test description">
<meta name="twitter:image" content="....">
May I know where did you test if the twitter card is working or not?
Did you check with https://cards-dev.twitter.com/validator?
Also, sometimes the placement of the meta tags do matter, place them early in the head section but after the og (open graph) meta-tags.
Let me know what error you get(if any) on the card validator.
If none of the above works, try changing twitter:image to twitter:image:src and make sure that the image fulfills the size requirements:
smallest size supported
summary: 144x144px
summary_large_image: 300x157px
Largest size supported
In both cases the maximum is 4096x4096px and at most 5MB.
Twitter share url
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="....">
<meta property="twitter:title" content=".....">
<meta property="twitter:description" content="test description">
<meta property="twitter:image" content="....">
Share Url : SHARE
It will work only on https
Twitter's card validator would return No meta tags found for me until I added the Content-Type: text/html header to the server's response.
From what I gather, Twitterbot doesn't even try to parse the page unless the server responds with the Content-Type it expects to see, which is text/html in this case.

Charset Encoding Issue with JavaDB and EclipseLink in JSF

I'm new at JSF projects. What I would like my project to display UTF-8 characters correctly. When I fill an inputText with UTF-8 characters and then I press commandButton, web site doesn't display it correctly. But I can insert a word that contains utf-8 into database. I use Apache Derby(JavaDB) and EclipseLink. How can I fix this issue ?
You could encode your HTTPHeader with UTF-8 in your servlet:
resource.setContentType ("text/html;charset=utf-8");
Also you could put this at the top of your page:
<%# page pageEncoding="UTF-8" %>
OR (The following within the header on your xHTML)
<meta http-equiv="content-type" content="text/html; charset=utf-8">
And also make sure your databases are encoding UTF-8:
ALTER DATABASE dbname DEFAULT CHARACTER SET utf8;

how to send an alert message with Turkish characters

I am programming a Web-Application with Java EE and JSF.
I want to give alert (javascript) messages with Turkish characters (such as Ç,ü and ö etc.) on my app. But, after alert function is fired, I see the alert message with unrelated characters such as <?>, instead of Turkish characters on .xhtml pages on any browser (I tried it on IE10 and Chrome).
I need an advice to handle the problem. If I find a solution, I can also use this to set values of element (ex./h:commandButton) by javascript.
EDIT:
Additional information - Static strings that includes Turkish letters on html or jsf tags are shown properly. However, when I change them via some javascript functions, if there is any Turkish characters in strings that are changed, these Turkish letters cannot be shown properly.
It is too old question but I want to answer for maybe someone need.
If your problem with alert messages, open your javascript file on notepad and save as with Utf-8 options.
Or you can use same technic for others js file you need encoding char.
If its just specific to chrome may be you could try changing the page encoding.
Got Control->Tools->Encoding and change that to Auto Detect or Unicode or turkish etc..
If its a general issue then add the meta info
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
or
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-9">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
<title>Sample</title>
<script>
function alertText() {
alert(document.getElementById("turkish").innerHTML);
}
</script>
</head>
<body>
<div id="turkish">Türkçe olarak hellow dünya</div>
<input type="Button" onclick="alertText()" value="Say" />
</body>
</html>

I use visual studio 2012 in windows 8 ASP design view shows Square for unicode characters

I really need help for this because when I write my code in source view, I have no problem but when I view it in design view it shows square instead of farsi characters.
how can I solve this problem?
There is no problem here:
make sure you have saved the final file with utf-8 with signature (file menu-> advanced save options)
add <meta charset="utf-8" /> to the head of the html page or your master page.
also you need these meta tags too: <meta http-equiv="Content-Language" content="fa" /> and <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Resources