Jump to content


ajax and cutenews


4 replies to this topic

#1 HEki_

    Young Padawan

  • Members
  • Pip
  • 165 posts

Posted 25 September 2007 - 11:08 AM

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

#2 NGPixel

    Senior Programmer

  • P2L Staff
  • PipPipPipPip
  • 1,410 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design : Coding : Animation

Posted 25 September 2007 - 06:23 PM

try to urlencode your data, then decode it in javascript to display it correctly.

#3 HEki_

    Young Padawan

  • Members
  • Pip
  • 165 posts

Posted 26 September 2007 - 12:36 AM

:g[1]: :wtf: :whoosh[1]: :blink: :huh:

sorry, but that is out of my league ... :(

#4 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

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
<?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 NGPixel

    Senior Programmer

  • P2L Staff
  • PipPipPipPip
  • 1,410 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design : Coding : Animation

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users