diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-11-07 21:08:23 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-11-07 21:08:23 +0000 |
commit | 83c69dc2eaf587d3346983575b6ab6018ecf3fad (patch) | |
tree | 9dd5f98cc00bf1715d2795adfd86417d304e795b /unicode/src/base/UIni.pas | |
parent | 36ad87b2e0d2f28ef7dc1e8c43c9aa2d1024daff (diff) | |
download | usdx-83c69dc2eaf587d3346983575b6ab6018ecf3fad.tar.gz usdx-83c69dc2eaf587d3346983575b6ab6018ecf3fad.tar.xz usdx-83c69dc2eaf587d3346983575b6ab6018ecf3fad.zip |
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
Diffstat (limited to '')
-rw-r--r-- | unicode/src/base/UIni.pas | 17 |
1 files changed, 14 insertions, 3 deletions
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]); |