文字列をヘブライ語エンコーディング (Windows 1255) に変換しようとしているので、任意の char 1264 の値を差し引いて、ここに新しい文字列を入れる必要があります。
これは、変換しようとしている JavaScript のコードです。
strText = strText.replace(/[א-ת]/ig, function(a,b,c) {
return escape(String.fromCharCode(a.charCodeAt(0)-1264));
});
これは私がJavaで作成したものですが、期待値が得られません:
String test = "שלום";
byte[] testBytes = test.getBytes();
String testResult = "";
for (int i = 0;i < testBytes.length;i++)
{
testResult += (char)((int)testBytes[i]-1264);
}
私は何を間違っていますか?