http://android.git.kernel.org/?p=platform/dalvik.git;a=commitdiff;h=e406b316295f07d40679ce2372051c3b2bce5de4;hp=8493876016e383b59af707cb5184100374f7f353
I found this commit has solved the bug, On Aug 14, 11:20 am, william <[email protected]> wrote: > hi, all > I met a strange error of charset encoding, see below code: > > public class CharsetMain extends Activity { > private final static String LOG_TAG = "zzw"; > > final String s123="1我2"; // at least one none-ascii > final String sabc="abcdef"; > > �...@override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > Log.d(LOG_TAG, sabc); // ok > > // set charset input to sabc > sabc.getBytes(); > > // fill charset input with s123 > Charset charset = java.nio.charset.Charset.forName("UTF-8"); > charset.encode(s123); > > Log.d(LOG_TAG, sabc); // bad > Log.d(LOG_TAG, "abcdef"); // bad > finish(); > } > > } > > string s123 contains a Chinese character, the last 2 log gives a bad > result, the string sabc is filled with string s123. > > I found the error is at com.ibm.icu4jni.charset.CharsetEncoderICU, > method getArray, about line 342. > it saves the internal buffer of input string, or just copy the input > string to it saved buffer, if 2 continuous calls are just the 2 > conditions, the later will copy the input string to the buffer of 1st > string. > > I am not sure it's a bug, but it cases Email program runs abnormally > with Chinese local. > > any idea? any comments are appreciated, thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

