www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - char and string with umlauts

reply "Jim Danley" <jimdanley2 gmail.com> writes:
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
Oct 20 2011
next sibling parent Trass3r <un known.com> writes:
Make sure your source file is saved in UTF-8 format.
Oct 20 2011
prev sibling next sibling parent Ali =?iso-8859-1?q?=C7ehreli?= <acehreli yahoo.com> writes:
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
Oct 20 2011
prev sibling parent GrahamC <grahamc001uk yahoo.co.uk> writes:
=0AOn Thu, 20 Oct 2011 19:48:54 +0300, Jim Danley wrote:=0A=0A>> I have bee=
n a programmer for many years and started using D about one=0A>> year back.=
=A0 Suddenly, I find myself in unfamiliar territory.=A0 I need to=0A>> used=
 Finish umlauts in chars and strings, but they are not part of my=0A>> usua=
l American ASCII character set.=0A=0A>As Trass3r said, the source code must=
 be saved in a standard Unicode=A0=0A>encoding. UTF-8 just works.=0A=0A>If =
your editor is UTF-8, then you should be able to use a Finnish=A0=0A>keyboa=
rd or copy/paste from another source like a web page or a character=A0=0A>m=
ap program in your system. (I use Emacs under Ubuntu with a Turkish=A0=0A>q=
uail keyboard mapping, which has been designed by me.)=0A=0A>> Can anyone p=
oint me in the right direction?=A0 I am getting "Invalid UTF-8=0A>> sequenc=
e" errors.=0A=0A>Could you please show a simple program?=0A=0A>>=A0=0A>> Th=
anks,=0A>>=A0=0A>> Jim=0A=0A>Ali=0A=0A=0AIf your text editor doesn't handle=
 UTF-8 then the \u escape followed by 4 digit hex value=0Acan be used, e.g.=
=0A=0Adchar[] lit =3D "\u0103\u0102\u00e4\u00c4";=0Awritefln("%s", lit);
Oct 20 2011