Hi,
when i use ajax to display cutenews data, ajax changes my čšž letters into some simbole ...
I tried to add the čšž as a special chars but nothing works ...
can anyone pls help me out with this? the charset on page is utf-8
best regards,
heki
ajax and cutenews
Started by HEki_, Sep 25 2007 11:08 AM
4 replies to this topic
#1
Posted 25 September 2007 - 11:08 AM
#2
Posted 25 September 2007 - 06:23 PM
try to urlencode your data, then decode it in javascript to display it correctly.
#3
Posted 26 September 2007 - 12:36 AM
sorry, but that is out of my league ...
#4
Posted 26 September 2007 - 04:27 AM
Couldn't you use preg_replace?
if you can't do what was mentioned above, then you could try something like this i guess?
here is an example from php.net
Here is an example of what you could do...
http://us3.php.net/m...reg-replace.php
Best I can think of....
if you can't do what was mentioned above, then you could try something like this i guess?
here is an example from php.net
<?php $string = 'The quick brown fox jumped over the lazy dog.'; $patterns[0] = '/quick/'; $patterns[1] = '/brown/'; $patterns[2] = '/fox/'; $replacements[2] = 'bear'; $replacements[1] = 'black'; $replacements[0] = 'slow'; ksort($patterns); ksort($replacements); echo preg_replace($patterns, $replacements, $string); ?>
Here is an example of what you could do...
<?php $string = 'my string quick č š ž lulz.'; $patterns[0] = '/č/'; $patterns[1] = '/š/'; $patterns[2] = '/ž/'; $replacements[2] = 'codez'; $replacements[1] = 'codes'; $replacements[0] = 'codec'; ksort($patterns); ksort($replacements); echo preg_replace($patterns, $replacements, $string); ?>
http://us3.php.net/m...reg-replace.php
Best I can think of....
#5
Posted 26 September 2007 - 07:56 AM
not sure how does this help at all lol, replacing won't change anything...
For urlencode in php, see http://ca3.php.net/m...n.urlencode.php
Then urldecode in javascript the content: http://www.kamath.co...y/cl006_url.asp
For urlencode in php, see http://ca3.php.net/m...n.urlencode.php
Then urldecode in javascript the content: http://www.kamath.co...y/cl006_url.asp
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
