Thread overview
char and string with umlauts
Oct 20, 2011
Jim Danley
Oct 20, 2011
Trass3r
Oct 20, 2011
Ali Çehreli
Oct 20, 2011
GrahamC
October 20, 2011
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.

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

Thanks,

Jim

October 20, 2011
Make sure your source file is saved in UTF-8 format.
October 20, 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
October 20, 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);