diff --git a/DiscImageChef.Filesystems/AppleMFS/Encoding.cs b/DiscImageChef.Filesystems/AppleMFS/Encoding.cs
index 2190fb96..c4e78b32 100644
--- a/DiscImageChef.Filesystems/AppleMFS/Encoding.cs
+++ b/DiscImageChef.Filesystems/AppleMFS/Encoding.cs
@@ -35,6 +35,130 @@ namespace DiscImageChef.Filesystems.AppleMFS
// Information from Inside Macintosh Volume II
partial class AppleMFS : Filesystem
{
+ ///
+ /// The MacRoman to Unicode character map.
+ ///
+ static readonly char[] MacRomanTable = {
+ // 0x00
+ '\u0000','\u0001','\u0002','\u0003','\u0004','\u0005','\u0006','\u0007',
+ // 0x08
+ '\u0008','\u0009','\u000A','\u000B','\u000C','\u000D','\u000E','\u000F',
+ // 0x10
+ '\u0010','\u0011','\u0012','\u0013','\u0014','\u0015','\u0016','\u0017',
+ // 0x18
+ '\u0018','\u0019','\u001A','\u001B','\u001C','\u001D','\u001E','\u001F',
+ // 0x20
+ '\u0020','\u0021','\u0022','\u0023','\u0024','\u0025','\u0026','\u0027',
+ // 0x28
+ '\u0028','\u0029','\u002A','\u002B','\u002C','\u002D','\u002E','\u002F',
+ // 0x30
+ '\u0030','\u0031','\u0032','\u0033','\u0034','\u0035','\u0036','\u0037',
+ // 0x38
+ '\u0038','\u0039','\u003A','\u003B','\u003C','\u003D','\u003E','\u003F',
+ // 0x40
+ '\u0040','\u0041','\u0042','\u0043','\u0044','\u0045','\u0046','\u0047',
+ // 0x48
+ '\u0048','\u0049','\u004A','\u004B','\u004C','\u004D','\u004E','\u004F',
+ // 0x50
+ '\u0050','\u0051','\u0052','\u0053','\u0054','\u0055','\u0056','\u0057',
+ // 0x58
+ '\u0058','\u0059','\u005A','\u005B','\u005C','\u005D','\u005E','\u005F',
+ // 0x60
+ '\u0060','\u0061','\u0062','\u0063','\u0064','\u0065','\u0066','\u0067',
+ // 0x68
+ '\u0068','\u0069','\u006A','\u006B','\u006C','\u006D','\u006E','\u006F',
+ // 0x70
+ '\u0070','\u0071','\u0072','\u0073','\u0074','\u0075','\u0076','\u0077',
+ // 0x78
+ '\u0078','\u0079','\u007A','\u007B','\u007C','\u007D','\u007E','\u007F',
+ // 0x80
+ '\u00C4','\u00C5','\u00C7','\u00C9','\u00D1','\u00D6','\u00DC','\u00E1',
+ // 0x88
+ '\u00E0','\u00E2','\u00E4','\u00E3','\u00E5','\u00E7','\u00E9','\u00E8',
+ // 0x90
+ '\u00EA','\u00EB','\u00ED','\u00EC','\u00EE','\u00EF','\u00F1','\u00F3',
+ // 0x98
+ '\u00F2','\u00F4','\u00F6','\u00F5','\u00FA','\u00F9','\u00FB','\u00FC',
+ // 0xA0
+ '\u2020','\u00B0','\u00A2','\u00A3','\u00A7','\u2022','\u00B6','\u00DF',
+ // 0xA8
+ '\u00AE','\u00A9','\u2122','\u00B4','\u00A8','\u2260','\u00C6','\u00D8',
+ // 0xB0
+ '\u221E','\u00B1','\u2264','\u2265','\u00A5','\u00B5','\u2202','\u2211',
+ // 0xB8
+ '\u220F','\u03C0','\u222B','\u00AA','\u00BA','\u03A9','\u00E6','\u00F8',
+ // 0xC0
+ '\u00BF','\u00A1','\u00AC','\u221A','\u0192','\u2248','\u2206','\u00AB',
+ // 0xC8
+ '\u00BB','\u2026','\u00A0','\u00C0','\u00C3','\u00D5','\u0152','\u0153',
+ // 0xD0
+ '\u2013','\u2014','\u201C','\u201D','\u2018','\u2019','\u00F7','\u25CA',
+ // 0xD8
+ '\u00FF','\u0178','\u2044','\u00A4','\u2039','\u203A','\uFB01','\uFB02',
+ // 0xE0
+ '\u2021','\u00B7','\u201A','\u201E','\u2030','\u00C2','\u00CA','\u00C1',
+ // 0xE8
+ '\u00CB','\u00C8','\u00CD','\u00CE','\u00CF','\u00CC','\u00D3','\u00D4',
+ // 0xF0
+ '\uF8FF','\u00D2','\u00DA','\u00DB','\u00D9','\u0131','\u02C6','\u02DC',
+ // 0xF8
+ '\u00AF','\u02D8','\u02D9','\u02DA','\u00B8','\u02DD','\u02DB','\u02C7'
+ };
+
+ ///
+ /// Converts a MacRoman character to an Unicode character
+ ///
+ /// Unicode character.
+ /// MacRoman character.
+ static char GetChar(byte character)
+ {
+ return MacRomanTable[character];
+ }
+
+ ///
+ /// Converts a MacRoman string, null-terminated or null-paded, to a C# string
+ ///
+ /// The C# string.
+ /// MacRoman string.
+ static string GetString(byte[] str)
+ {
+ string uni = "";
+
+ foreach(byte b in str)
+ {
+ if(b == 0x00)
+ break;
+
+ uni += MacRomanTable[b];
+ }
+
+ return uni;
+ }
+
+ ///
+ /// Converts a MacRoman string, in Pascal length-prefixed format, to a C# string
+ ///
+ /// The C# string.
+ /// The MacRoman string in Pascal format.
+ static string GetStringFromPascal(byte[] PascalString)
+ {
+ if(PascalString == null)
+ return null;
+
+ string uni = "";
+
+ byte length = PascalString[0];
+
+ if(length > PascalString.Length - 1)
+ length = (byte)(PascalString.Length - 1);
+
+ for(int i = 1; i < length + 1; i++)
+ {
+ uni += MacRomanTable[PascalString[i]];
+ }
+
+ return uni;
+ }
}
}
diff --git a/DiscImageChef.Filesystems/AppleMFS/Info.cs b/DiscImageChef.Filesystems/AppleMFS/Info.cs
index 5084f12d..66dfe38a 100644
--- a/DiscImageChef.Filesystems/AppleMFS/Info.cs
+++ b/DiscImageChef.Filesystems/AppleMFS/Info.cs
@@ -99,19 +99,19 @@ namespace DiscImageChef.Filesystems.AppleMFS
BB.sec_sv_pages = BigEndianBitConverter.ToInt16(bb_sector, 0x008);
Array.Copy(mdb_sector, 0x00A, pString, 0, 16);
- BB.system_name = StringHandlers.PascalToString(pString);
+ BB.system_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x01A, pString, 0, 16);
- BB.finder_name = StringHandlers.PascalToString(pString);
+ BB.finder_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x02A, pString, 0, 16);
- BB.debug_name = StringHandlers.PascalToString(pString);
+ BB.debug_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x03A, pString, 0, 16);
- BB.disasm_name = StringHandlers.PascalToString(pString);
+ BB.disasm_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x04A, pString, 0, 16);
- BB.stupscr_name = StringHandlers.PascalToString(pString);
+ BB.stupscr_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x05A, pString, 0, 16);
- BB.bootup_name = StringHandlers.PascalToString(pString);
+ BB.bootup_name = GetStringFromPascal(pString);
Array.Copy(mdb_sector, 0x06A, pString, 0, 16);
- BB.clipbrd_name = StringHandlers.PascalToString(pString);
+ BB.clipbrd_name = GetStringFromPascal(pString);
BB.max_files = BigEndianBitConverter.ToUInt16(bb_sector, 0x07A);
BB.queue_size = BigEndianBitConverter.ToUInt16(bb_sector, 0x07C);
diff --git a/DiscImageChef.Filesystems/ChangeLog b/DiscImageChef.Filesystems/ChangeLog
index 1eaaaf71..85205a39 100644
--- a/DiscImageChef.Filesystems/ChangeLog
+++ b/DiscImageChef.Filesystems/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-01 Natalia Portillo
+
+ * Info.cs:
+ * Encoding.cs: Added MacRoman to Unicode.
+
+ * Encoding.cs: Corrected Unicode mapping.
+
2016-08-01 Natalia Portillo
* Dir.cs:
diff --git a/DiscImageChef.Filesystems/LisaFS/Encoding.cs b/DiscImageChef.Filesystems/LisaFS/Encoding.cs
index eeccfaa6..7027b836 100644
--- a/DiscImageChef.Filesystems/LisaFS/Encoding.cs
+++ b/DiscImageChef.Filesystems/LisaFS/Encoding.cs
@@ -80,7 +80,7 @@ namespace DiscImageChef.Filesystems.LisaFS
// 0x98
'\u00F2','\u00F4','\u00F6','\u00F5','\u00FA','\u00F9','\u00FB','\u00FC',
// 0xA0
- '\u0086','\u00B0','\u00A2','\u00A3','\u00A7','\u0095','\u00B6','\u00DF',
+ '\u2020','\u00B0','\u00A2','\u00A3','\u00A7','\u2022','\u00B6','\u00DF',
// 0xA8
'\u00AE','\u00A9','\u2122','\u00B4','\u00A8','\u2260','\u00C6','\u00D8',
// 0xB0
@@ -88,7 +88,7 @@ namespace DiscImageChef.Filesystems.LisaFS
// 0xB8
'\u220F','\u03C0','\u222B','\u00AA','\u00BA','\u03A9','\u00E6','\u00F8',
// 0xC0
- '\u00BF','\u00A1','\u00AC','\u221A','\u0083','\u2248','\u2206','\u00AB',
+ '\u00BF','\u00A1','\u00AC','\u221A','\u0192','\u2248','\u2206','\u00AB',
// 0xC8
'\u00BB','\u2026','\u00A0','\u00C0','\u00C3','\u00D5','\u0152','\u0153',
// 0xD0