char and string with umlauts

GrahamC grahamc001uk at yahoo.co.uk
Thu Oct 20 14:11:22 PDT 2011


On Thu, 20 Oct 2011 19:48:54 +0300, Jim Danley wrote:

>> I have been a programmer for many years and started using D about one
>> year back.  Suddenly, I find myself in unfamiliar territory.  I need to
>> used Finish umlauts in chars and strings, but they are not part of my
>> usual American ASCII character set.

>As Trass3r said, the source code must be saved in a standard Unicode 
>encoding. UTF-8 just works.

>If your editor is UTF-8, then you should be able to use a Finnish 
>keyboard or copy/paste from another source like a web page or a character 
>map program in your system. (I use Emacs under Ubuntu with a Turkish 
>quail keyboard mapping, which has been designed by me.)

>> Can anyone point me in the right direction?  I am getting "Invalid UTF-8
>> sequence" errors.

>Could you please show a simple program?

>> 
>> Thanks,
>> 
>> Jim

>Ali


If your text editor doesn't handle UTF-8 then the \u escape followed by 4 digit hex value
can be used, e.g.

dchar[] lit = "\u0103\u0102\u00e4\u00c4";
writefln("%s", lit);


More information about the Digitalmars-d-learn mailing list