Reputation: 337
I am using iconv to convert string from CP1251 to UTF-8 Problem is that string length before conversion is 4 bytes, after 8.
After converting i send message to Apple servers, where is length is limited.
How I can get conversion and keep the same length?
Upvotes: 0
Views: 895
Reputation: 23769
There is no way you can do it. In UTF-8 one-byte codes are used only for the ASCII values 0 through 127. In this case the UTF-8 code has the same value as the ASCII code. The high-order bit of these codes is always 0.
As you are trying to encode non-ASCII characters, you'll get more, then 1 byte per character.
http://en.wikipedia.org/wiki/UTF-8#Overlong_encodings
Upvotes: 1