Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UTF-8 characters not displaying correctly in Inno Setup

Tags:

inno-setup

I've seen a couple of other threads about this but I've spent a while trying to get it sorted to no avail.

Here's a generic version of my .iss file:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define AppName "MyApp"
#define CompanyName "MyCompany"
#define FileName "File Name"
#define AppExeName "App Exe.exe"
#define AppIcon "..\icon.ico"
#define AppId "app.id"
#define AppURL "mywebsite"
#define AppSrcDir "path\to\app\directory"
#define AppTargetDir "{userappdata}\" + CompanyName + "\" + AppName
#define AppVersion GetFileVersion(AppSrcDir + "\" + AppExeName)
#define AppPublisher "Publisher"
#define LaunchMessage "Launch Message"
#define AppProtocol "protocol"
#define OutputDir "path\to\output"
#define SetupFilename FileName + "-setup-" + AppVersion
#define SetupImage "..\setup.bmp"
#define InstallerMessage "Some message with a German character - ö"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)

AllowCancelDuringInstall=no
AppId={#AppId}
AppName={#AppName}
AppVersion={#AppVersion}
AppVerName={#AppName} {#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={#AppTargetDir}
DefaultGroupName={#CompanyName}
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyPage=yes
DisableReadyMemo=yes
OutputDir={#OutputDir}
OutputBaseFilename={#SetupFilename}
PrivilegesRequired=lowest
SetupIconFile={#AppIcon}
SignTool=signtool
Compression=lzma/ultra64
SolidCompression=yes
WizardSmallImageFile={#SetupImage}
UninstallDisplayIcon={app}\{#AppExeName}

[InstallDelete]
Type: filesandordirs; Name: {#AppTargetDir}

[Languages]
Name: de; MessagesFile: "compiler:Languages\German.isl"

[Files]
Source: "{#AppSrcDir}\*"; DestDir: "{app}"; Flags: recursesubdirs
Source: "path\to\other\installers\win32\*"; DestDir: "{app}\redist";
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}";
Name: "{commondesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}";

[Run]
FileName: "{app}\redist\installer.exe"; Parameters: "/S /v/qn"; WorkingDir: "{app}"; StatusMsg: "{#InstallerMessage}";

The problem I have is that it doesn't display the InstallerMessage text correctly. The ö character does not render correctly.

I am using the Unicode version of Inno Setup (with the "(u)").

I have seen some mentions of using a byte order mark but I haven't seen any examples. I tried converting the whole string using a UTF-8 encoder and added the byte order mark at the start but it didn't work. I'm completely stumped!

like image 910
Reverate Avatar asked Jun 27 '18 15:06

Reverate


1 Answers

Make sure your .iss file uses UTF-8 encoding with BOM.

And of course, you need Unicode version of Inno Setup (the only version as of Inno Setup 6).


Was the string also used in Pascal Script code (what is not, mentioning it just for benefit of others, who may find this question), you also have to use Inno Setup 5.6.0 or later. Earlier versions did not support UTF-8 in Pascal Script.

Pascal Scripting changes:
Unicode Inno Setup: Unicode is now supported for the input source. For example, where before you had to write S := #$0100 + #$0101 + 'Aa'; you can now write S := 'ĀāAa'; directly. Also see the new UnicodeExample1.iss example script.

like image 178
Martin Prikryl Avatar answered Sep 22 '22 05:09

Martin Prikryl