2016-04-18 8 views
1

コンシューマデバイスでは(メインフレームではなく)合理的に一般的で、文字はA-Za-z0-9とはASCIIとは異なる文字エンコーディングがありますか?文字の場合でもASCIIと異なるエンコーディング

現在、私はJavaアプリケーションについて考えているので、一部の国のJavaソフトウェアのカジュアルなユーザーがdefaultCharsetと報告されてしまう可能性があるかどうかは疑問です。"AZaz09".getBytes()"AZaz09".getBytes("UTF-8")。私は、この点で異なる動作から生じるかもしれない特定の互換性の問題に対処する必要があるかどうかを試しています。

私は歴史的に、EBCDICがASCII互換でないエンコードの主要な例であることを知っています。しかし、それは最近の民生機器、あるいはIBMのメインフレームとヴィンテージのコンピュータだけで使用されていますか? EBCDICの遺産は、いくつかの国の共通のエンコーディングで生きていますか?

また、UTF-16はASCIIと互換性がなく、Windows上でファイルをそのようにエンコードすることはかなり一般的です。しかし、私が知る限り、これは常にファイルの内容であり、デフォルトのアプリケーションロケールではありません。ユーザーは、少なくとも半分のアプリケーションを壊すことなく、UTF-16をシステムコードページとして使用するようにWindowsマシンを構成することは可能ですか?

私が知る限り、アジアで使用されるすべてのUnicode前のマルチバイトエンコーディングは、ASCII範囲00-7Fを少なくとも文字と数字にASCIIと互換性のあるものにマップします。まだ使用中のアジア系エンコーディングはありますか?の場合、すべて1バイト以上を使用します。コードポイント?あるいは、おそらく他の大陸で?

答えて

3

ここでは簡単に見つけ出すプログラムがあります。失敗した文字セットが十分に一般的であるかどうかを判断するのはあなた次第です。

import java.nio.charset.Charset; 
import java.nio.charset.StandardCharsets; 
import java.util.Arrays; 

public class EncodingTest { 
    public static void main(String[] args) { 
     String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 
     byte[] b = s.getBytes(StandardCharsets.UTF_8); 
     for (Charset cs : Charset.availableCharsets().values()) { 
      try { 
       byte[] b2 = s.getBytes(cs); 
       if (!Arrays.equals(b, b2)) { 
        System.out.println(cs.displayName() + " doesn't give the same result"); 
       } 
      } 
      catch (Exception e) { 
       System.out.println(cs.displayName() + " throws an exception"); 
      } 
     } 
    } 
} 

私のマシン上の結果は、上場のための

IBM-Thai doesn't give the same result 
IBM01140 doesn't give the same result 
IBM01141 doesn't give the same result 
IBM01142 doesn't give the same result 
IBM01143 doesn't give the same result 
IBM01144 doesn't give the same result 
IBM01145 doesn't give the same result 
IBM01146 doesn't give the same result 
IBM01147 doesn't give the same result 
IBM01148 doesn't give the same result 
IBM01149 doesn't give the same result 
IBM037 doesn't give the same result 
IBM1026 doesn't give the same result 
IBM1047 doesn't give the same result 
IBM273 doesn't give the same result 
IBM277 doesn't give the same result 
IBM278 doesn't give the same result 
IBM280 doesn't give the same result 
IBM284 doesn't give the same result 
IBM285 doesn't give the same result 
IBM290 doesn't give the same result 
IBM297 doesn't give the same result 
IBM420 doesn't give the same result 
IBM424 doesn't give the same result 
IBM500 doesn't give the same result 
IBM870 doesn't give the same result 
IBM871 doesn't give the same result 
IBM918 doesn't give the same result 
ISO-2022-CN throws an exception 
JIS_X0212-1990 doesn't give the same result 
UTF-16 doesn't give the same result 
UTF-16BE doesn't give the same result 
UTF-16LE doesn't give the same result 
UTF-32 doesn't give the same result 
UTF-32BE doesn't give the same result 
UTF-32LE doesn't give the same result 
x-IBM1025 doesn't give the same result 
x-IBM1097 doesn't give the same result 
x-IBM1112 doesn't give the same result 
x-IBM1122 doesn't give the same result 
x-IBM1123 doesn't give the same result 
x-IBM1364 doesn't give the same result 
x-IBM300 doesn't give the same result 
x-IBM833 doesn't give the same result 
x-IBM834 doesn't give the same result 
x-IBM875 doesn't give the same result 
x-IBM930 doesn't give the same result 
x-IBM933 doesn't give the same result 
x-IBM935 doesn't give the same result 
x-IBM937 doesn't give the same result 
x-IBM939 doesn't give the same result 
x-JIS0208 doesn't give the same result 
x-JISAutoDetect throws an exception 
x-MacDingbat doesn't give the same result 
x-MacSymbol doesn't give the same result 
x-UTF-16LE-BOM doesn't give the same result 
X-UTF-32BE-BOM doesn't give the same result 
X-UTF-32LE-BOM doesn't give the same result 
+0

おかげです。残念ながら、これらの文字セットがアプリケーションのデフォルトの文字セットとしてどのくらい一般に使用されているかを判断するのは難しいです。コードページの流行統計などはまだ見つかりませんでした。 IBMのページは、DOSやメインフレームのように聞こえる。 JIS X 0212はASCII互換のEUC-JP内で使用されていたようです。 ISO-2022-CNは、復号化にのみ使用できます。 – MvG

関連する問題