May 21, 2011 Re: How to print unicode like: こ ん に ち は 世界 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Ong | On 5/21/2011 2:46 PM, Matthew Ong wrote: > On 5/20/2011 2:55 PM, Russel Winder wrote: >> On Thu, 2011-05-19 at 22:37 +0200, Andrej Mitrovic wrote: >> [ . . . ] >>> You would also need a Unicode-aware font, maybe Lucida or something >>> similar. Typically fixed-point fonts used for programming have little >>> support for Unicode characters, and you would get back a black or >>> white box like "[]". >> >> Alternatively use a nice proportional font with Unicode support for code >> so it is more readable? >> >> Backward compatibility with 80x24 terminals is just so last millennium. >> > Hi All, > > Thanks for the example code on the unicode issue. > > hi Andrej, > version(Windows) > { > import std.c.windows.windows; > extern(Windows) BOOL SetConsoleOutputCP(UINT); > } > > void main() > { > version(Windows) SetConsoleOutputCP(65001); > writeln("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界"); > } > > I am running this on a M$ Vista Professional edition. > > Unfortunately that code sample does not work... Please see attachment. > > The reason I am testing this is to understand how the stream library works. > > Console test is fundamental test to see if the language handles unicode > within the source code itself automatically and display them correctly > when it does file IO, network and also GUI level. > > Normally in mordern languages it should, because that allow a developer > to easily define a simple resource bundle file to loaded automatically > within the same fragment of code. If not, then, there is going to be > problem. I hope we do not need to write such code: > > version(English){ > // some code > }version(Chinese_MainLand){ > // some other code > }version(Chinese_HongKong){ > // yet another code > }...etc > > I have originally plan to send an attached screen shot but it is not > working for the newsgroup. Perhaps someone can show me how to do that here. > Hi All, correction on my part. It does seem like a font issue. Strangely the same console program that used to be able to show unicode correctly for both java and go is no longer working??? I think it is true, it has nothing to do with D. More like a font thing. The result I got working is within the Eclipse Java and Go Console but NOT the DDT D console. Without IDE, all of them show garbage... Perhaps some one can kindly show me how the console fonts setting works for M$ Vista. >Unicode-aware font, maybe Lucida< How I tried Lucida it also does not work. There is only 2 fonts shown int the Command Prompt Properties Font Tab. -- Matthew Ong email: ongbp@yahoo.com |
May 21, 2011 Re: How to print unicode like: $B$3(B $B$s(B $B$K(B $B$A(B $B$O(B $B@$3&(B | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Ong | Oh yeah cmd.exe doesn't really have that many font options. Personally I use console2 from http://sourceforge.net/projects/console/ , which has font options and nice things compared to cmd.exe. (It's really just a GUI wrapper with some extras). |
May 23, 2011 Re: How to print unicode like: こ ん に ち は 世界 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 5/21/2011 7:42 PM, Andrej Mitrovic wrote: > Oh yeah cmd.exe doesn't really have that many font options. Personally > I use console2 from http://sourceforge.net/projects/console/ , which > has font options and nice things compared to cmd.exe. (It's really > just a GUI wrapper with some extras). Thanks a lot mate. Will look into it. -- Matthew Ong email: ongbp@yahoo.com |
Copyright © 1999-2021 by the D Language Foundation