{"action":"created","issue":{"url":"https://api.github.com/repos/clouway/chita/issues/41","labels_url":"https://api.github.com/repos/clouway/chita/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/clouway/chita/issues/41/comments","events_url":"https://api.github.com/repos/clouway/chita/issues/41/events","html_url":"https://github.com/clouway/chita/issues/41","id":112373017,"number":41,"title":"consider adding a default TextUnicodeTransport","user":{"login":"mlesikov","id":210499,"avatar_url":"https://avatars.githubusercontent.com/u/210499?v=3","gravatar_id":"","url":"https://api.github.com/users/mlesikov","html_url":"https://github.com/mlesikov","followers_url":"https://api.github.com/users/mlesikov/followers","following_url":"https://api.github.com/users/mlesikov/following{/other_user}","gists_url":"https://api.github.com/users/mlesikov/gists{/gist_id}","starred_url":"https://api.github.com/users/mlesikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlesikov/subscriptions","organizations_url":"https://api.github.com/users/mlesikov/orgs","repos_url":"https://api.github.com/users/mlesikov/repos","events_url":"https://api.github.com/users/mlesikov/events{/privacy}","received_events_url":"https://api.github.com/users/mlesikov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/clouway/chita/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-20T13:49:16Z","updated_at":"2015-10-20T13:59:06Z","closed_at":null,"body":"We are having troubles when we use the default text transport to our app, so I suggest that we could add\r\n ```java\r\npublic class TextUtf8Transport implements Transport, com.clouway.chita.Transport{\r\n\r\n  @Override\r\n  public <T> T in(InputStream inputStream, Class<T> aClass) throws IOException {\r\n    return (T) new String(ByteStreams.toByteArray(inputStream), \"UTF8\");\r\n  }\r\n\r\n  @Override\r\n  public <T> T in(InputStream inputStream, TypeLiteral<T> typeLiteral) throws IOException {\r\n    return (T) new String(ByteStreams.toByteArray(inputStream), \"UTF8\");\r\n  }\r\n\r\n  @Override\r\n  public <T> void out(OutputStream outputStream, Class<T> aClass, T t) throws IOException {\r\n    String content = (String) t;\r\n    IOUtils.write(content, outputStream, \"UTF8\");\r\n  }\r\n\r\n  @Override\r\n  public String contentType() {\r\n    return \"text/xml\";\r\n  }\r\n}\r\n```\r\n\r\nmaybe we have to consider and adding methods for easier configuration of the contentType\r\n\r\n```java\r\nhttpRequest(new TargetUrl(configuration.targetUrl)).post(xmlInput)\r\n            .basicAuthorization(configuration.user, configuration.password)\r\n            .addProperty(\"Content-Type\",\"text/xml; charset=utf-8\")\r\n            .addProperty(\"SOAPAction\", configuration.action)\r\n            .addProperty(\"Content-Length\",\"\" + buffer.length)\r\n            .as(TextUtf8Transport.class).build();\r\n```\r\ncan be \r\n```java\r\nhttpRequest(new TargetUrl(configuration.targetUrl)).post(xmlInput)\r\n            .basicAuthorization(configuration.user, configuration.password)\r\n            .contentType(hml).charset(''utf-8)\r\n            .as(TextUtf8Transport.class).build();\r\n````\r\nthis means that the content type could be moved out of the Transport or it could be overridden\r\n"},"comment":{"url":"https://api.github.com/repos/clouway/chita/issues/comments/149576336","html_url":"https://github.com/clouway/chita/issues/41#issuecomment-149576336","issue_url":"https://api.github.com/repos/clouway/chita/issues/41","id":149576336,"user":{"login":"mlesikov","id":210499,"avatar_url":"https://avatars.githubusercontent.com/u/210499?v=3","gravatar_id":"","url":"https://api.github.com/users/mlesikov","html_url":"https://github.com/mlesikov","followers_url":"https://api.github.com/users/mlesikov/followers","following_url":"https://api.github.com/users/mlesikov/following{/other_user}","gists_url":"https://api.github.com/users/mlesikov/gists{/gist_id}","starred_url":"https://api.github.com/users/mlesikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlesikov/subscriptions","organizations_url":"https://api.github.com/users/mlesikov/orgs","repos_url":"https://api.github.com/users/mlesikov/repos","events_url":"https://api.github.com/users/mlesikov/events{/privacy}","received_events_url":"https://api.github.com/users/mlesikov/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T13:59:06Z","updated_at":"2015-10-20T13:59:06Z","body":"content type is set to from the Transport and from the httpRequestBuilder, in this case the problem is caused by the Transport 'contentType' is applied.  "}}