ufk Posted January 28, 2004 Share Posted January 28, 2004 how can i change the default charset to utf8? Link to comment Share on other sites More sharing options...
241 Posted January 28, 2004 Share Posted January 28, 2004 Have you tried search hebrew. read the forum rules about multi posting the same question in the same thread category ;) No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
ufk Posted January 28, 2004 Author Share Posted January 28, 2004 but you don't understand my question! i did search hebrew! i figured out that you misunderstood my question cause i said hebrew in the topic so i wrote another one! i did search hebrew and no one used unicode for hebrew! they only used windows-1255 and that's not what i need! so this is a generic question on how to set the default charset to UTF8 that's all! :) please reply! Link to comment Share on other sites More sharing options...
241 Posted January 28, 2004 Share Posted January 28, 2004 did you try windows-1250 or a google search on UTF8 for php Is your idea to convert the characters <?php /** * RFC1738 compliant replacement to PHP's rawurldecode - which actually works with unicode (using utf-8 encoding) * @author Ronen Botzer * @param $source [STRING] * @return unicode safe rawurldecoded string [STRING] * @access public */ function utf8RawUrlDecode ($source) { $decodedStr = ''; $pos = 0; $len = strlen ($source); while ($pos < $len) { $charAt = substr ($source, $pos, 1); if ($charAt == '%') { $pos++; $charAt = substr ($source, $pos, 1); if ($charAt == 'u') { // we got a unicode character $pos++; $unicodeHexVal = substr ($source, $pos, 4); $unicode = hexdec ($unicodeHexVal); $entity = "". $unicode . ';'; $decodedStr .= utf8Encode ($entity); $pos += 4; } else { // we have an escaped ascii character $hexVal = substr ($source, $pos, 2); $decodedStr .= chr (hexdec ($hexVal)); $pos += 2; } } else { $decodedStr .= $charAt; $pos++; } } return $decodedStr; } /** * The following is actually a javascript method I had to write to replace escape(). * escape() is the javascript method equivalent to PHP's rawurlencode(), however it doesn't encode utf-8 multibyte characters correctly in most browsers. */ // Warning: the following code is JavaScript. Ugh. :D // use this instead of escape() to ensure a correctly encoded url string (RFC1738) function urlEncode (str) { len = str.length; res = new String(); charOrd = new Number(); for (i = 0; i < len; i++) { charOrd = str.charCodeAt(i); if ((charOrd >= 65 && charOrd <= 90) || (charOrd >= 97 && charOrd <= 122) || (charOrd >= 48 && charOrd <= 57) || (charOrd == 33) || (charOrd == 36) || (charOrd == 95)) { // this is alphanumeric or $-_.+!*'(), which according to RFC1738 we don't escape res += str.charAt(i); } else { res += '%'; if (charOrd > 255) res += 'u'; hexValStr = charOrd.toString(16); if ((hexValStr.length) % 2 == 1) hexValStr = '0' + hexValStr; res += hexValStr; } } return res; } ?> No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
ufk Posted January 28, 2004 Author Share Posted January 28, 2004 hiya! :) thanks for all of that info but it's not needed! the problem is that i tried: @setlocale(LC_TIME, 'iw_HE.utf8'); @setlocale(LC_TIME, 'he_IL.utf8'); @setlocale(LC_TIME, 'utf8'); and also define('HTML_PARAMS','dir="RTL" lang="UTF-8"'); but still the default encoding for that page is not UTF8! any ideas why? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.