{"action":"opened","issue":{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/153","labels_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/153/comments","events_url":"https://api.github.com/repos/chrsmith/google-api-java-client/issues/153/events","html_url":"https://github.com/chrsmith/google-api-java-client/issues/153","id":59522431,"number":153,"title":"Detect Unicode encoding for GSON library","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/Component-JSON","name":"Component-JSON","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/google-api-java-client/labels/Type-Enhancement","name":"Type-Enhancement","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-02T18:25:58Z","updated_at":"2015-03-02T18:25:58Z","closed_at":null,"body":"```\nExternal references, such as a standards document, or specification?\n\nhttp://blog.publicobject.com/2010/08/handling-byte-order-mark-in-java.html\n\ncopied here (in case that blog goes away):\n\n  public Reader inputStreamToReader(InputStream in) throws IOException {\n    in.mark(3);\n    int byte1 = in.read();\n    int byte2 = in.read();\n    if (byte1 == 0xFF && byte2 == 0xFE) {\n      return new InputStreamReader(in, \"UTF-16LE\");\n    } else if (byte1 == 0xFF && byte2 == 0xFF) {\n      return new InputStreamReader(in, \"UTF-16BE\");\n    } else {\n      int byte3 = in.read();\n      if (byte1 == 0xEF && byte2 == 0xBB && byte3 == 0xBF) {\n        return new InputStreamReader(in, \"UTF-8\");\n      } else {\n        in.reset();\n        return new InputStreamReader(in);\n      }\n    }\n  }\n\nJava environments (e.g. Java 6, Android 2.3, App Engine 1.4.2, or All)?\n\nAll\n\nPlease describe the feature requested.\n\nCurrently the GSON library implementation only supports UTF-8.  The algorithm \nabove could potentially be used for supporting the other 3 Unicode encodings \nsupported by the JSON specifications.\n```\n\nOriginal issue reported on code.google.com by `yan...@google.com` on 19 Mar 2011 at 9:32"}}