tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: print encoded string on stdout

> I am given a data buffer (const, not nul terminated) claiming to
> contain an encoded text string and I know the language & encoding
> (likely "en" & "UTF-8" but no guarantee) and I want to safely display
> this string on stdout.

"Safely" - my first question is, safe against what?  What kinds of
threats are you trying to defeat here?  Until you (we) know that, you
(we) can't really thwart them very well.

Second question is, how much do you care about the user seeing glyphs
similar to those for the characters in the string?  I'm thinking about
cases like the buffer containing, say, U+1698, or U+10EC, when the
user's using an ISO-8859-1 (or, worse, ASCII) display device; how much
do you care what happens in a case like that?  (Even assuming you can
_tell_ what the user's using.)

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index