Jump to content

[SOLVED] identifying different unicode/utf-8 types inside a text string


dsaba

Recommended Posts

I am dealing with a script that reverses a string that is in hebrew, so I can display it properly when I write that string onto an image, however sometimes the string might be half hebrew half english, so I need a way to identify what language is in the string and only reverse the hebrew parts.

 

in technical terms the hebrew text is encoded in utf-8, and the english text will be encoded in the normal encoding for english, (anscii, latin-swedish whatever, i dont know the name of that encoding)

 

so the simple question is how do I identify different types of encoding within a string?

that way I can break up the parts that i identify as being utf-8 and reverse only those

 

 

(yes I am well aware of methods to display hebrew properly in php, but when writing to an image this is another story, only method i found so far is reversing the hebew text string)

 

-all thoughts are welcome on this, even if you dont know the direct answer, perhaps other methods of doing this

-thank you for your help

thanks for the reply :)

 

I discovered that you can identify the encoding of a string by the mb_encoding whatever function, however that still won't identify only hebrew since the english will be in same encoding as well

 

so:

i have written a script that makes an array of all hebrew letters and then acts upon that

as the hebrew characters themselves are the defining elements to determine the language

 

but I have a problem with my preg_match function

http://www.phpfreaks.com/forums/index.php/topic,133261.0.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.