www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Invalid trainling code unit

reply "rumbu" <rumbu rumbu.ro> writes:
I'm trying to understand how strings are working in D. I got the 
following error when declaring a simple string variable: "Invalid 
trailing code unit":

wstring needle = `Être sans la verité`;

Considering that the line obove is copied exactl from the site 
examples, what I'm doing wrong?
Dec 14 2012
next sibling parent reply "Joshua Niehus" <jm.niehus gmail.com> writes:
On Saturday, 15 December 2012 at 06:07:10 UTC, rumbu wrote:
 I'm trying to understand how strings are working in D. I got 
 the following error when declaring a simple string variable: 
 "Invalid trailing code unit":

 wstring needle = `Être sans la verité`;

 Considering that the line obove is copied exactl from the site 
 examples, what I'm doing wrong?
works for me and on the DPaste site: http://dpaste.dzfl.pl/00b66ba8 what platform are you on and what version of D are you using? are you passing any compiler flags or just running plain ol' "$>rdmd test.d" ?
Dec 14 2012
parent "rumbu" <rumbu rumbu.ro> writes:
On Saturday, 15 December 2012 at 06:22:50 UTC, Joshua Niehus 
wrote:
 On Saturday, 15 December 2012 at 06:07:10 UTC, rumbu wrote:
 I'm trying to understand how strings are working in D. I got 
 the following error when declaring a simple string variable: 
 "Invalid trailing code unit":

 wstring needle = `Être sans la verité`;

 Considering that the line obove is copied exactl from the site 
 examples, what I'm doing wrong?
works for me and on the DPaste site: http://dpaste.dzfl.pl/00b66ba8 what platform are you on and what version of D are you using? are you passing any compiler flags or just running plain ol' "$>rdmd test.d" ?
I'm using D-Ide, compiling with "DMD32 D Compiler v2.060" with the following arguments: -c "$src" -of"$obj" $importPaths -gc -debug -w -unittest
Dec 14 2012
prev sibling parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 12/14/2012 10:07 PM, rumbu wrote:
 I'm trying to understand how strings are working in D. I got the
 following error when declaring a simple string variable: "Invalid
 trailing code unit":

 wstring needle = `Être sans la verité`;

 Considering that the line obove is copied exactl from the site examples,
 what I'm doing wrong?
Works here as well. My guess is that the encoding of the source code is not one of the Unicode encodings, rather a "code table" encoding. If so, please save the source code in a UTF encoding, e.g. UTF-8. Ali
Dec 14 2012
parent "rumbu" <rumbu rumbu.ro> writes:
On Saturday, 15 December 2012 at 06:37:51 UTC, Ali Çehreli wrote:
 Works here as well.

 My guess is that the encoding of the source code is not one of 
 the Unicode encodings, rather a "code table" encoding. If so, 
 please save the source code in a UTF encoding, e.g. UTF-8.

 Ali
Yes, it was ANSI encoded (I think this is the default encoding in D-IDE), I converted the file to UTF-8 and it's compiling. Thanks for your help.
Dec 15 2012