I have a lot of text that I need to display, including all kinds of characters from many languages. Sometimes I need to output text to a character encoding other than Unicode (like Shift-JIS or ISO-8859-2) to match the page it will be on.
If there are characters in the text that the encoding cannot process (for example, Japanese characters in the ISO-8859-2 encoded output), I get odd characters in the output. I can avoid them, but I would prefer to do this only if it is really necessary.
So my question is this: is there a way I can tell in advance if the encoding can handle all the characters in my string?
EDIT: I think EncoderFallback is probably the correct answer to the question I asked. Unfortunately, this does not work in my specific situation. My thought was to convert characters to their equivalent HTML objects (e.g. & # 12514 instead of モ). However, the encoder only converts the first such character that it finds, and if I set Response.ContentEncoding, it never calls my EncoderFallback at all.
source
share