Menu

#9 ISO Encoding

open
nobody
None
5
2012-09-15
2005-06-13
No

In non-english systems the ISO encoding is not
correctly handled (for example ISO-8859-2). To make it
work all right the following changes need be introduced:

in EncodedString.cs:

private byte[] ISO_8859_1Bytes
{
get
{
return Encoding.Default.GetBytes(str);
}
set
{
this.String = Encoding.Default.GetString(value);
}
}

private string ISO_8859_1String
{
get
{
return str;
}
}

in ID3v1Tag.cs:

protected static string BytesToString( byte[] bytes )
{
string str = Encoding.Default.GetString(bytes);
// handle null-termination
int stringEnd = str.IndexOf( (char) 0x0 );
if ( stringEnd == -1 )
{
stringEnd = str.Length;
}
str = str.Substring( 0, stringEnd );
str = str.Trim();
return str;
}

in ID3Tag.cs:

protected byte[] StringToBytes( string str )
{
return Encoding.Default.GetBytes(str);
}

Discussion


Log in to post a comment.