public void SetJavaValue(String aString, int codepage) { String stringNT = aString + "\0"; if (codepage == -1) { _value = Encoding.UTF8.GetBytes(stringNT); } else { _value = CodePageUtil.GetBytesInCodePage(stringNT, codepage); } //_value = Encoding.GetEncoding(codepage).GetBytes(aString + "\0"); }
protected internal static string GetString(byte[] data, CodepageRecord codepage) { int cp = CodePageUtil.CP_ISO_8859_1; if (codepage != null) { cp = codepage.Codepage & 0xffff; } try { return(CodePageUtil.GetStringFromCodePage(data, cp)); } catch (EncoderFallbackException uee) { throw new ArgumentException("Unsupported codepage requested", uee); } }
/** * <p>Turns a codepage number into the equivalent character encoding's * name.</p> * * @param codepage The codepage number * * @return The character encoding's name. If the codepage number is 65001, * the encoding name is "UTF-8". All other positive numbers are mapped to * "cp" followed by the number, e.g. if the codepage number is 1252 the * returned character encoding name will be "cp1252". * * @exception UnsupportedEncodingException if the specified codepage is * less than zero. */ public static String CodepageToEncoding(int codepage) { return(CodePageUtil.CodepageToEncoding(codepage)); }