Created
November 9, 2014 10:42
-
-
Save alexlehm/9b8d3202552e223bc55e to your computer and use it in GitHub Desktop.
fix location encoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String fixStringEncoding(String s) { | |
byte[] bytes=new byte[s.length()]; | |
for(int i=0;i<s.length();i++) { | |
bytes[i]=(byte) (s.charAt(i)&0xff); | |
} | |
try { | |
return new String(bytes,"utf-8"); | |
} catch (UnsupportedEncodingException e) { | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment