native的Socket向Android的LocalSocketServer发送汉字乱码的问题
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                native的Socket向Android的LocalSocketServer发送汉字乱码的问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                native的Socket發送字節流默認是GB2312的,所以在Java方面需要指定GB2312
byte[] buffer = new byte[50]; StringBuffer strBuf = new StringBuffer(); InputStream input = receiver.getInputStream(); while((len = input.read(buffer)) != -1) {String newStr = new String(buffer, 0, len, "GB2312");strBuf.append(newStr); }?reference:
http://hi.baidu.com/cmdmac/item/9a6cf9dc3254dfe6795daaa9
http://www.cnblogs.com/kenkofox/archive/2010/04/23/1719009.html
http://www.cnblogs.com/uuhua/archive/2010/06/15/1758552.html
?
轉載于:https://www.cnblogs.com/GloriousOnion/archive/2012/11/19/2777221.html
總結
以上是生活随笔為你收集整理的native的Socket向Android的LocalSocketServer发送汉字乱码的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 在VB应用程序中调用Excel2000
 - 下一篇: 推荐一篇讲解各种debug技术的文章,相