Quantcast
Channel: JACKSLACK 의 블로그
Viewing all articles
Browse latest Browse all 148

안드로이드 JNI C, C++ 코드에서 한글 인코딩 관련

$
0
0
C, C++ 코드에는 멀티바이트(한글)이 있고,자바에 리턴할 인코딩은 UTF8 이어야 한다.해결법은,자바쪽 함수 콜백에 euc-kr -> UTF8 코드를 만들고,C++ 에서 자바함수를 호출한다.해당 자바코드는 private static String callbackEuc2UTF8( String strWhat ) { if(strWhat.equals("")) return "NO INPUT"; String strTo = null; try { byte[] raws = strWhat.getBytes("euc-kr"); strTo = new String( raws, "utf-8" ); Log.i(DEBUG_TAG, "입력된 문자영은 " + strWhat + ", 변환된 문자열은 " + strWhat ); } catch( java.io.UnsupportedEncodingException e ) { Log.i(DEBUG_TAG, "UnsupportedEncodingException!!!"); } r.......

Viewing all articles
Browse latest Browse all 148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>