/// <summary> /// Takes a string that is a representation of the raw sequence of bytes /// encoded using an ISO repertoire, but current encoded as a Unicode string /// and gives back a true Unicode string, e.g. containing the Japanese Kanji /// characters /// </summary> /// <param name="rawData">Sequence of bytes formatted in Unicode</param> /// <param name="repertoire">Original ISO repertoire used in the encoding</param> /// <returns>True Unicode string</returns> private static string Decode(string rawData, CharacterSetInfo repertoire) { // get it back to byte array form using a character set that includes // both GR and GL areas (characters up to \xff in binary value) // and it seems Windows-1252 works better than ISO-8859-1 byte[] rawBytes = IsomorphicEncoding.GetBytes(rawData); return(Decode(rawBytes, repertoire)); }
public static byte[] GetIsomorphicBytes(string rawBytesEncodedAsString) { // add a null terminator, otherwise we're going to have problems in the unamanged world if (rawBytesEncodedAsString == null) { return(null); } return(IsomorphicEncoding.GetBytes(rawBytesEncodedAsString)); }