0

I want to convert a string from 1252 char code set to UTF-8. For this I used iconv library in my c++ application development which is based on linux platform.

I used the the API iconv() and converted my string.

there is a character è in my input. UTF-8 also does support to this character. So when my conversion is over, my output also should contain the same character è.

But When I see the output, Character è is converted to è which I don't want.

One more point is if the converter found any unknown character, that should be automatically replaced with the default REPLACEMENT CHARACTER of UTF-8 �(FFFD) which is not happening.

How can I achieve the above two points with the library iconv.

I used the below APIs to convert the string

1)iconv_open("UTF-8","CP1252")

2)iconv() - Pass the parameters required

3)iconv_close(cd)

Can any body help me to sort out this issue please......

1 Answers1

0

Please use this to replace invalid utf-8 charaters.

iconv_open("UTF-8//IGNORE","CP1252")
Anurag
  • 77
  • 9