Skip to content

Instantly share code, notes, and snippets.

@alexlehm
Created November 9, 2014 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexlehm/9b8d3202552e223bc55e to your computer and use it in GitHub Desktop.
Save alexlehm/9b8d3202552e223bc55e to your computer and use it in GitHub Desktop.
fix location encoding
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