Thread overview
when compiling: unsupported char 0xc2
Aug 19, 2008
Markku Sukanen
Aug 19, 2008
bearophile
Aug 19, 2008
Markku Sukanen
Aug 19, 2008
Frank Benoit
Aug 19, 2008
Markku Sukanen
August 19, 2008
Got a "little" problem with source code and the characters/letters used in it...  And would like to know how to rectify this:

I'm usually using 'vim' (or 'gvim') for editing source codes, but now as learning D as new language, came against a problem with '|' (the vertical bar) in source code.  Whenever dmd encounters a '|' in code (outside string literals), it errors out with i.e.:

    ...somesource.d(84): unsupported char 0xc2

So, for now, have had to put i.e. "if (a == 2 || b == 3)" to separate if/
else's.
August 19, 2008
Markku Sukanen:
> I'm usually using 'vim' (or 'gvim') for editing source codes, but now as
> learning D as new language, came against a problem with '|' (the vertical
> bar) in source code.  Whenever dmd encounters a '|' in code (outside
> string literals), it errors out with i.e.:
>     ...somesource.d(84): unsupported char 0xc2
> So, for now, have had to put i.e. "if (a == 2 ||Â b == 3)" to separate if/
> else's.

The '|' char is 124, not 0xc2 (that is 194 in decimal). I have no problems using the vertical bar in my D source code. You probably are doing something wrong, if you take a look at this post you can see your editor is using something past 7-bit ASCII, try a different editor.

Bye,
bearophile
August 19, 2008
Tue, 19 Aug 2008 06:51:25 -0400, bearophile wrote:

> Markku Sukanen:
>> I'm usually using 'vim' (or 'gvim') for editing source codes, but now
>> as learning D as new language, came against a problem with '|' (the
>> vertical bar) in source code.  Whenever dmd encounters a '|' in code
>> (outside string literals), it errors out with i.e.:
>>     ...somesource.d(84): unsupported char 0xc2
>> So, for now, have had to put i.e. "if (a == 2 ||Â b == 3)" to separate
>> if/ else's.
> 
> The '|' char is 124, not 0xc2 (that is 194 in decimal). I have no problems using the vertical bar in my D source code. You probably are doing something wrong, if you take a look at this post you can see your editor is using something past 7-bit ASCII, try a different editor.
> 
Hmm, after checking my source code and my own post to this newsgroup with a hexedit, I think it's not just editor issue... there's an invisible "0xC2" character following the 2nd '|' in my own post and the source code...

Not a D, issue. Heh, sry - should've thought checking the hexdump earlier.
August 19, 2008
Markku Sukanen schrieb:
> Hmm, after checking my source code and my own post to this newsgroup with a hexedit, I think it's not just editor issue... there's an invisible "0xC2" character following the 2nd '|' in my own post and the source code...
> 
> Not a D, issue. Heh, sry - should've thought checking the hexdump earlier.

check the encoding vim uses
D accepts either ascii (<=127) or unicode.

  :set encoding=utf-8



August 19, 2008
Tue, 19 Aug 2008 14:12:56 +0200, Frank Benoit wrote:

> Markku Sukanen schrieb:
>> Hmm, after checking my source code and my own post to this newsgroup with a hexedit, I think it's not just editor issue... there's an invisible "0xC2" character following the 2nd '|' in my own post and the source code...
>> 
>> Not a D, issue. Heh, sry - should've thought checking the hexdump earlier.
> 
> check the encoding vim uses
> D accepts either ascii (<=127) or unicode.
> 
>   :set encoding=utf-8

Ah! Thanks, that fixed it.