Help with Special Characters

Discuss any general programming issues here
Post Reply
PEB
Posts: 567
Joined: Sun Feb 21, 2010 1:28 am

Help with Special Characters

Post by PEB »

Before Hollywood 7, I would use this to get an em dash:
EmDash$=Chr($e2)..Chr($80)..Chr($94)

With Hollywood 7, that doesn't work any more. So what's the best way to accomplish this now?

This doesn't work either:
EmDash$=ConvertStr(Chr($e2)..Chr($80)..Chr($94), #ENCODING_ISO8859_1, #ENCODING_UTF8)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Help with Special Characters

Post by airsoftsoftwair »

You need to think in Unicode now. It's no longer necessary to construct UTF-8 sequences manually. So you could either just save your script as UTF-8 and just use the em dash in your code like this:

Code: Select all

EmDash$ = "—"
or if you want to construct it manually, just use its Unicode codepoint which is $2014 (8212 in decimal notation), like so:

Code: Select all

EmDash$ = Chr($2014)
Much easier than with older Hollywood versions...
PEB
Posts: 567
Joined: Sun Feb 21, 2010 1:28 am

Re: Help with Special Characters

Post by PEB »

Thanks!

(I have to construct it manually with Chr() because CodeBench doesn't support Unicode characters.)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Help with Special Characters

Post by airsoftsoftwair »

PEB wrote:(I have to construct it manually with Chr() because CodeBench doesn't support Unicode characters.)
Ok. Might be a good idea to file a feature request with the CodeBench authors so that they add UTF-8 support. I'm not even sure if there's a text editor on OS4 which supports UTF-8 at all. MorphOS has Scribble which supports it but on OS4 I don't know if there is any UTF-8 editor...
Post Reply