-
-4 14
-
1.下载源码,可以去官网git,这个不说了找下资料看看
2.找到ddms的源代码,具体的目录在D:\android_source_code\platform\sdk\ddms\libs\ddmlib\src\com\android\ddmlib
下面的EmulatorConsole.java类中
3. 找这个方法
/**
* Provides control over emulated hardware of the Android emulator.
* <p/>This is basically a wrapper around the command line console normally used with telnet.
*<p/>
* Regarding line termination handling:<br>
* One of the issues is that the telnet protocol <b>requires</b> usage of <code>\r\n</code>. Most
* implementations don't enforce it (the dos one does). In this particular case, this is mostly
* irrelevant since we don't use telnet in Java, but that means we want to make
* sure we use the same line termination than what the console expects. The console
* code removes <code>\r</code> and waits for <code>\n</code>.
* <p/>However this means you <i>may</i> receive <code>\r\n</code> when reading from the console.
* <p/>
* <b>This API will change in the near future.</b>
*/
public final class EmulatorConsole {
private final static String DEFAULT_ENCODING = "ISO-8859-1"; //$NON-NLS-1$
修改这个编码为utf-8
然后把D:\android_source_code\platform\sdk\ddms\libs\ddmlib\ 当做一个工作区导成jar文件也就是E:\www\android-sdk_r06-windows\tools\lib\ddmlib.jar这个包 替换下,重启下模拟器ok了。
效果图如下:

jar包下载www.spridu.cn/UPLOAD/2011/4/ddmlib.jar
如果还不行的话,你就要升级你的sdk,因为最新更新的sdk已经解决了中文乱码的问题。
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
- 评论(1)
发表评论 TrackBack