Reply to Re: RTF export: UTF-8 to ANSI conversion?

Your name:

Reply:


Posted by Markus on 07/12/07 15:45

iktorn schrieb:
> Markus napisał(a):
>> Hello
>>
>> I try to write RTF files using text in UTF-8 encoding. Converting the
>> text with utf8_decode() already fails on characters such as an
>> apostrophe or an endash.
>> So these are actually my questions:
>> - Is there a good way to convert an UTF-8 string into CP1252, without
>> losing the non-CP1252 character info? (mbstring is not available on
>> that server)
>
> You will always lose some characters wile converting utf-8 to encoding
> that can handle up to 255 chars.
>
> I haven't done anything related to RTF, but to convert UTF8 to CP-1252
> you can use iconv library:
> http://pl.php.net/manual/en/ref.iconv.php
>
> with optional //IGNORE and //TRANSLIT modifiers
>

Thank you! From my first look at iconv, //IGNORE will make it unlossy;
anyway there would be no way to identify the unconverted characters (in
order to convert them to RTF Unicode syntax).

Meantime I found a solution using PEAR I18N_UnicodeString:
http://pear.php.net/package/I18N_UnicodeString

This gives me an array of the decimal Unicode representations of all
characters; so I can convert every character individually.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация