Page 1 of 1
[NEWBIE QUESTION] - UTF8 language settings
Posted: Sat Sep 27, 2008 6:20 am
by dymo310
hi
i have translated an ENGLISH language file to NORWEGIAN. the result of this is that the norwegian special characters wont show properly (ÆØÅæøå).
the file is saved with UTF-8 encoding using Rapid PHP Editor, in addition i have tried to insert the following into the page, inside the <?php :
mb_internal_encoding("UTF-8");
this does not help at all. any suggestion that might lead to a solution would be (highly) appriciated.
thx
Re: [NEWBIE QUESTION] - UTF8 language settings
Posted: Tue Sep 30, 2008 5:54 am
by dymo310
all this brain and no suggestions?
..
Re: [NEWBIE QUESTION] - UTF8 language settings
Posted: Tue Sep 30, 2008 6:00 am
by papa
I did a function with preg_replace for Micro$oft Word and swedish letters...
Code: Select all
function display($text) {
//patterns to replace
$patterns = array("/´/", "/&/", "/É/", "/é/", "/’/", "/“/", "/”/", "/Å/", "/å/", "/Ä/", "/ä/", "/Ö/", "/ö/",
//linkto
"/linkto:([^http].{1,})<([a-z0-9._-\s&]+)>/i",
//external linkto
"/linkto:(http:\/\/[a-zA-Z0-9._-]+)<([a-zA-Z0-9._-\s&]+)>/",
//linkto no desc
"/linkto:([^http][a-zA-Z0-9._-\s&]+)/i",
//external linkto no desc
"/linkto:(http:\/\/[a-zA-Z0-9._-]+)/",
//mailto
"/mailto:([a-z0-9._-]+@[a-z0-9-]+\.[a-z.]{2,5})<([a-z0-9._-\s@]+)>/i",
//Img
"/img:([a-z0-9._-]+)/i");
//replacements
$replacements = array("'", "&", "É", "é", "’", "“", "”", "Å", "å", "Ä", "ä", "Ö", "ö",
"<a href=\"$1\">$2</a>",
"<img src=\"./Common/gul_pil.gif\" alt=\"gul_pil\" /><a href=\"$1\" target=\"self\">$2</a>",
"<a href=\"$1\">$1</a>",
"<a href=\"$1\" target=\"self\">$1</a>",
"<img src=\"./Common/mail.gif\" alt=\"mail\" /> <a href=\"mailto:$1\">$2</a>",
"image man");
$text = preg_replace($patterns, $replacements, $text);
return $text;
}
The other patterns are linking url or mailto in content text.
Hope it helps. Validates at least.
Norwegian chars should be here:
http://webdesign.about.com/library/bl_htmlcodes.htm