PDA

View Full Version : Ajax Tabs Content script - Turkish Characters Prtoblem :(



kramp
09-21-2006, 06:43 PM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem: thanks to everybody who has writed that script. its very nice script but i have a problem.
i am including a .asp page to the script :
<li><a href="xx1.asp" rel="ajaxcontentarea">Title1</a></li>
like that and in the xx1.asp file it has Turkish characters like (ç,ü,ş,ı)
when i run the script it doesnt support turkish caracters and changes them to the (?) . example;
it writes : fenerbahçe
but its shown : fenerbah?
like that.
thanks again

yubon
09-22-2006, 05:27 PM
You can use this!
Put it in the<head>tag
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO 8859-9">
now the encoding is turkish!

kramp
09-23-2006, 07:24 PM
thanks for the answer but i put that before but it didnt changed my problem.
i solved that problem with a ascii characters, if you write the ascii code of the character its good than. example;
&#xf6; for "&#246;"

mwinter
09-23-2006, 08:11 PM
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO 8859-9">
now the encoding is turkish!

It isn't, for two reasons. The first is that the encoding is specified incorrectly: it should be "iso-8859-9" (you omitted the first hyphen). The second, and more significant, is that a meta element in the calling document has no effect whatsoever on processing an AJAX response.

As I understand it, without information to contrary, browsers will assume that the contents of a response is encoded using UTF-8. US-ASCII (7-bit) and UTF-8 documents will be interpreted correctly, but there are no guarantees for anything else. The only effective way to change this is have the server send a Content-Type header containing a charset parameter, though it's probably better to stick to UTF-8 or 7-bit ASCII.




i solved that problem with a ascii characters, if you write the ascii code of the character ...

You mean a character reference that specifies a Unicode code point. ASCII only contains 128 characters, which includes Latin letters (a-z), numbers, basic punctuation, and 33 control characters (0x00-0x1f, 0x7f).

Be aware that using a character reference only works if the data is later processed as HTML or XML.

Mike

jscheuer1
09-23-2006, 09:48 PM
thanks for the answer but i put that before but it didnt changed my problem.
i solved that problem with a ascii characters, if you write the ascii code of the character its good than. example;
&#xf6; for "ö"

mwinter's right that won't work unless the data is later parsed as XML or HTML but, usually it is. Sometimes though, this is not enough. The javascript entity might work in those situations:

\xf6

mwinter
09-24-2006, 04:13 PM
The javascript entity might work in those situations:

\xf6

Escape sequences (entity is a markup term) are only recognised as such in string literals. If that were included in a response to an AJAX request, the responseText string would contain precisely those four characters.

Mike

jscheuer1
09-24-2006, 06:07 PM
If that were included in a response to an AJAX request, the responseText string would contain precisely those four characters.

That's the idea. If the response text isn't going to be parsed as HTML or XML, it may very well be parsed as javascript. If that were the case, you would want the escape sequence not the entity. If it is parsed as HTML, it should still be rendered as hoped for:


<div id="tt"></div>
<script type="text/javascript">
document.write('\xf6');
document.getElementById('tt').innerHTML='\xf6';
</script>

Both of these produce the same result on the page. The Ajax Tabs script uses the response text as the target element's innerHTML.