views:

372

answers:

3

EDIT: the script mentioned in the question, and the other script pointed among the answers, both work just fine with multibyte strings - turned out my problem was elsewhere.

Does anyone know of such implementation? The script at http://phpjs.org/functions/view/469 works well, just not on multibyte strings.

+1  A: 

The script you've posted has str = utf8_encode(str);.
You should probably remove this line and pass in your Cyrillic as UTF-8.

Greg
+4  A: 

This implementation seems to handle UTF-8 strings correctly. If you want to test the demo, make sure you change the encoding of the page to UTF-8 in your browser settings first.

Ayman Hourieh
A: 

You could check my implementation.

valums