Displaying non UTF-8 8 bit character codes with writefln()
Stewart Gordon
smjg_1998 at yahoo.com
Fri Oct 5 06:44:58 PDT 2007
"Regan Heath" <regan at netmail.co.nz> wrote in message
news:fe5d88$15l$1 at digitalmars.com...
<snip>
> 1. avoid the valid utf-8 cahracter check.
> 2. make the console display utf-8 correctly.
>
> To achive #1 you've gotta use printf, eg.
> printf("%c\n", 230);
No I gottan't. I could use putchar, puts or OutputStream.writeString for
example.
<snip>
>> This misses the point slightly. The user shouldn't have to change the
>> codepage just to get someone else's application to work properly.
>
> Sadly, if the application is outputting UTF-8 you don't have a choice.
But how many DOS or Windows console apps in the real world output UTF-8?
Presumably not many, considering that no versions of DOS and only a few
versions of Windows support it. There's also a causal loop in that even
modern Windows versions don't come with the console code page set to 65001
by default. I don't know what is likely to break this loop, but I doubt
that the restrictiveness of one language's standard library is going to do
it.
>> What you want is my utility library:
>> http://pr.stewartsplace.org.uk/d/sutil/
>
> Cool. You're converting UTF-8 to the console code page I assume.
Exactly. (Well, as exactly as is possible under the constraints.)
Stewart.
--
My e-mail address is valid but not my primary mailbox. Please keep replies
on the 'group where everybody may benefit.
More information about the Digitalmars-d-learn
mailing list