From 83c69dc2eaf587d3346983575b6ab6018ecf3fad Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 7 Nov 2008 21:08:23 +0000 Subject: Unicode Text-file support - lyrics, song-title, artist, etc. are now UTF8 strings - filenames need some work (UTF-8 on Mac, otherwise still native encoding. Should always be UTF-8 instead) File encoding: - if the file starts with a UTF-8 BOM, UTF-8 is assumed - if the file contains an encoding header (#ENCODING: UTF8/CP1252/CP1250), the given encoding is used - if neither of the previous applies the default encoding (stored in the config-file, default CP1252 = USDX 1.01a encoding) is used git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1510 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/base/UIni.pas | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'unicode/src/base/UIni.pas') diff --git a/unicode/src/base/UIni.pas b/unicode/src/base/UIni.pas index f50f95ce..2bf49d9d 100644 --- a/unicode/src/base/UIni.pas +++ b/unicode/src/base/UIni.pas @@ -37,6 +37,7 @@ uses Classes, IniFiles, ULog, + UTextEncoding, SysUtils; type @@ -84,11 +85,11 @@ type procedure LoadScreenModes(IniFile: TCustomIniFile); public - Name: array[0..11] of string; + Name: array[0..11] of UTF8String; // Templates for Names Mod - NameTeam: array[0..2] of string; - NameTemplate: array[0..11] of string; + NameTeam: array[0..2] of UTF8String; + NameTemplate: array[0..11] of UTF8String; //Filename of the opened iniFile Filename: string; @@ -155,6 +156,9 @@ type // Controller Joypad: integer; + // default encoding for texts (lyrics, song-name, ...) + EncodingDefault: TEncoding; + procedure Load(); procedure Save(); procedure SaveNames; @@ -724,6 +728,10 @@ begin // NoteLines NoteLines := GetArrayIndex(INoteLines, IniFile.ReadString('Lyrics', 'NoteLines', INoteLines[1])); + //Encoding default + // CP1252 is the USDX <1.1 default encoding + EncodingDefault := ParseEncoding(IniFile.ReadString('Lyrics', 'Encoding', ''), encCP1252); + LoadThemes(IniFile); // Color @@ -872,6 +880,9 @@ begin // NoteLines IniFile.WriteString('Lyrics', 'NoteLines', INoteLines[NoteLines]); + //Encoding default + IniFile.WriteString('Lyrics', 'Encoding', EncodingNames[EncodingDefault]); + // Theme IniFile.WriteString('Themes', 'Theme', ITheme[Theme]); -- cgit v1.2.3