Help with Special Characters

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

Help with Special Characters

Post by PEB » Sat Mar 25, 2017 5:13 am

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: 2482
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Help with Special Characters

Post by airsoftsoftwair » Sat Mar 25, 2017 1:48 pm

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: 168
Joined: Sun Feb 21, 2010 2:28 am

Re: Help with Special Characters

Post by PEB » Sat Mar 25, 2017 7:30 pm

Thanks!

(I have to construct it manually with Chr() because CodeBench doesn't support Unicode characters.)

User avatar
airsoftsoftwair
Posts: 2482
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Help with Special Characters

Post by airsoftsoftwair » Sun Mar 26, 2017 12:04 pm

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