Page 1 of 1

Help with Special Characters

Posted: Sat Mar 25, 2017 4:13 am
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)

Re: Help with Special Characters

Posted: Sat Mar 25, 2017 12:48 pm
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...

Re: Help with Special Characters

Posted: Sat Mar 25, 2017 6:30 pm
by PEB
Thanks!

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

Re: Help with Special Characters

Posted: Sun Mar 26, 2017 12:04 pm
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...