You are here

create a new Charset environment variable

1 post / 0 new
Last seen: 10 years 5 months ago
Joined: 2013-12-22 03:15
create a new Charset environment variable

As I checked the manual of PortableApps.comLauncher,
i didn't find a section in launcher.ini to setup charset for portable applications.

So i just wrote some customized nsis script to export charset environment variable.
Hopefully it is usefull for you.

The logic is:

Check PAL:LanguageCustom value,
if not set use English as default.

Use the result as a key to get value from section [LanguageCharsetMap]
and export the value as PAL:CharsetCustom.

If not found then use DefaultCharset in section [Language]
or UTF-8 as fallback.

Code is below:

        ReadEnvStr $1 PAL:LanguageCustom
        ${If} $1 == ""
                ${DebugMsg} " Platform language variables are missing."
                StrCpy $1 English

        ; Get the charset
        ${DebugMsg} "Reading the Charset from launcher.ini by key `$1`."
        ${ReadLauncherConfig} $2 LanguageCharsetMap $1
        ${IfNot} ${Errors}
                ${ParseLocations} $2
                ${DebugMsg} "Setting PAL:CharsetCustom to $2 based on the [LanguageCharsetMap] section."
                ${SetEnvironmentVariable} PAL:CharsetCustom $2
                ; Set the default values
                ${ReadLauncherConfig} $0 Language DefaultCharset
                ${IfNot} ${Errors}
                        ${ParseLocations} $0
                        ${DebugMsg} "Setting PAL:CharsetCustom to $0 by default."
                        ${SetEnvironmentVariable} PAL:CharsetCustom $0
                        ${DebugMsg} "Setting PAL:CharsetCustom to UTF-8 by default."
                        ${SetEnvironmentVariable} PAL:CharsetCustom UTF-8