Menu ▾ ▴

#450 New constants to specify special characters in strings.

closed
Scripting (152)
5
2013-04-03
2008-08-31
Anonymous
No

To go with the constants that can be used in strings, ($$, $\r, $\n, $\t), I suggest a set of constants that allow you to specify special ASCII characters in a string. It would be of the form "$\x__", where __ is a hexadecimal number between 00 (0) and FF (255).
For example, "$\x99" would display the trade mark sign (ASCII 153).

Sort of related: I would also like to see the curly single and double quotes (ASCII 145, 146, 147 and 148) be allowed to be used interchangably with the regular quote characters (', " and `). As pointless as this would be to a lot of people, it would allow someone to "beautify" their script, which I often like to do...

Thanks.

Brad.

Discussion

  • Amir Szekely

    Amir Szekely - 2008-09-05

    Logged In: YES
    user_id=584402
    Originator: NO

    You can use IntFmt %c for the first part.

    As for the quotes, wouldn't that pose a problem with different codepages?

     
  • Michael Madsen

    Michael Madsen - 2008-09-06

    Logged In: YES
    user_id=1340616
    Originator: NO

    The quotes (U+2018, U+2019, U+201C, U+201D) would indeed be an issue when developing the install script on systems with different codepages, since their values are > U+0080 - but it is, of course, not an issue at run-time. Because of that, such a change (if implemented at all) should probably be deferred that until Jim's Unicode branch is merged into trunk.

    Thinking forward, the first part also has issues. The $\x syntax, although allowing for compile-time substitution, would either require a change when migrating to Unicode, or some kind of clever parsing where you prefix with 00 if you want a Unicode character X where U+007F < X < U+0100 - but even that might not work as intended, since I might have $\xA92008 - in an ANSI script on a Western European codepage, that would result in ©2008. In Unicode, parsing that would result in ꤠ08 (KAYAH LI LETTER VA, U+A920).

    IntFmt is actually slightly worse, because unlike the $\x syntax, you can't necessarily determine the output at compile-time, and even if you could, it has the same ANSI/Unicode value mismatch issue. It would, however, be easier to go beyond the BMP (U+10000 and up)

    A better solution, in my opinion is to just inline the character at leave it at that. It's trivial to start up Character Map (Start > Run > charmap) and find what you need, and it requires less work when migrating to Unicode.

     
  • Anders

    Anders - 2013-04-03
    • status: open --> closed
     
  • Anders

    Anders - 2013-04-03

    ${U+1}...${U+FFFFFFFF} are now treated as a Unicode codepoint.

    ASCII ends at 127, dealing with quotes outside basic ASCII would be a pain in makensis because our strings are now wchar_t* internally and wchar_t is compiler specific...

     

Log in to post a comment.