...

Russian Characters

Fletcher
09-05-2002, 03:32 AM
If I type Russian characters into a form field it for some reason converts into gibberish!? Please help. I am using Windows XP Professional. Is my configurations wrong?

Test:

Русский

Quiet Storm
09-05-2002, 06:36 PM
Is this on your website, or someone else's?

Fletcher
09-05-2002, 07:18 PM
Well, it's important because I have a database and I want to insert foreign characters into it from the form fields. (PHP + MySQL)

Do you see Russian characters (something like Pycckuu) or gibberish (something like Donneee) in my post above below the word "Test:".

Quiet Storm
09-06-2002, 06:24 AM
Try putting this on the pages you need the characters:


<HTML>
<HEAD>


<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=koi8-r">


</HEAD>

Fletcher
09-06-2002, 01:29 PM
Thanks a lot! That worked. Suppose I wanted to have a multidude of languages though. What should I do then?

Quiet Storm
09-06-2002, 04:48 PM
original script (http://www.javascriptkit.com/script/script2/language.shtml)

Maybe you could do something like this?:

<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--//
var type=navigator.appName
if (type=="Netscape")
var lang = navigator.language
else
var lang = navigator.userLanguage
var lang = lang.substr(0,2)

// english
if (lang == "en")
document.write('<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-language" CONTENT="en">')

// russian
else if (lang == "ru")
document.write('<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=koi8-r">
<META HTTP-EQUIV="Content-language" CONTENT="ru">')

// french
else if (lang == "fr")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Content-language" CONTENT="fr">')

// german
else if (lang == "de")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Content-language" CONTENT="de">')

// greek
else if (lang == "el")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-8859-7">
<META HTTP-EQUIV="Content-language" CONTENT="el">')

// hebrew
else if (lang == "iw")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-8859-8">
<META HTTP-EQUIV="Content-language" CONTENT="iw">')

// chinese
else if (lang == "zh")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=hz-gb-2312">
<META HTTP-EQUIV="Content-language" CONTENT="zh">')

// korean
else if (lang == "ko")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ksc_5601">
<META HTTP-EQUIV="Content-language" CONTENT="ko">')

// japanese
else if (lang == "ja")
document.write('<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=iso-2022-jp">
<META HTTP-EQUIV="Content-language" CONTENT="ja">')

// if none of above (default to English or any other)
else
document.write('<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-language" CONTENT="en">')

//-->
</SCRIPT>


</HEAD>


Depending on what your visitors' browser language is set to, it will display the characters correctly. If you have your browser set for english, and try to type in Пишите Русскому , it will show up as 'gibberish' again.

*Just found this:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

Try putting just that on your site and see if that works first - before putting up all that JavaScript. :)

Fletcher
09-06-2002, 06:55 PM
hmm, actually, I want to be able to display characters from multiple languages simultaneously.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum