tags:

views:

20

answers:

1

I read some string with (windows-1256) encoding but the numbers in that string encoded using (UTF-8) and as a result all text except numbers (encoded with utf-8) read but numbers displays as (?) which is acceptable. but i want to know how can i read complete text without problem, how can i know when to switch between encodings to read correct text.
NOTE: Browsers displays these kind of text correctly so they know when they should switch

Any solution or code ?

A: 

The lower half of the windows-1256 code page is the same as ASCII. Digits in UTF-8 are also the same as ASCII - if you read the string with windows-1256 encoding, it should work just fine.

Carl Norum
Unless they are [Eastern Arabic](http://en.wikipedia.org/wiki/Eastern_Arabic_numerals) numbers.
dreamlax
Yes thats exactly arabic numbers and if I read them with windows-1256 that would return (?)
Ehsan
@Carl you are right, but arabic numbers has different ASCII code and the problem is reading UTF8 arabic number with windows-1256, i should somehow detect numbers and read them with correct encoding.
Ehsan
Oh I misunderstood; sorry about that. I'm not sure mixing encodings is going to be something easy to pull apart...
Carl Norum