You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Simon Legault (JIRA)" <ji...@apache.org> on 2010/11/30 19:16:13 UTC
[jira] Created: (WW-3536) Specify UTF-8 content type in
JsonLibHandler
Specify UTF-8 content type in JsonLibHandler
--------------------------------------------
Key: WW-3536
URL: https://issues.apache.org/jira/browse/WW-3536
Project: Struts 2
Issue Type: Bug
Components: Plugin - REST
Affects Versions: 2.1.8.1
Environment: Java 5; Firefox 3.6
Reporter: Simon Legault
Priority: Trivial
Response returned by the REST plugin does not specify the character encoding. Firefox 3.6 reads the incoming JSON incorrectly for non-ANSI characters. Specifying the character encoding explicitly (;charset=utf-8) fixes the problem.
public class JsonLibHandler implements ContentTypeHandler {
...
public String getContentType() {
return "text/javascript;charset=utf-8";
}
...
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Resolved] (WW-3536) Specify UTF-8 content type in
JsonLibHandler
Posted by "Johannes Geppert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johannes Geppert resolved WW-3536.
----------------------------------
Resolution: Fixed
Fix Version/s: 2.3
The JSON Content Handler respects now your Default Encoding.
private static final String DEFAULT_CONTENT_TYPE = "application/json";
private String defaultEncoding = "ISO-8859-1";
public String getContentType() {
return DEFAULT_CONTENT_TYPE+";charset=" + this.defaultEncoding;
}
@Inject(StrutsConstants.STRUTS_I18N_ENCODING)
public void setDefaultEncoding(String val) {
this.defaultEncoding = val;
}
> Specify UTF-8 content type in JsonLibHandler
> --------------------------------------------
>
> Key: WW-3536
> URL: https://issues.apache.org/jira/browse/WW-3536
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 2.1.8.1
> Environment: Java 5; Firefox 3.6
> Reporter: Simon Legault
> Assignee: Johannes Geppert
> Priority: Trivial
> Fix For: 2.3
>
>
> Response returned by the REST plugin does not specify the character encoding. Firefox 3.6 reads the incoming JSON incorrectly for non-ANSI characters. Specifying the character encoding explicitly (;charset=utf-8) fixes the problem.
> public class JsonLibHandler implements ContentTypeHandler {
> ...
> public String getContentType() {
> return "text/javascript;charset=utf-8";
> }
> ...
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WW-3536) Specify UTF-8 content type in
JsonLibHandler
Posted by "Johannes Geppert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johannes Geppert reassigned WW-3536:
------------------------------------
Assignee: Johannes Geppert
> Specify UTF-8 content type in JsonLibHandler
> --------------------------------------------
>
> Key: WW-3536
> URL: https://issues.apache.org/jira/browse/WW-3536
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 2.1.8.1
> Environment: Java 5; Firefox 3.6
> Reporter: Simon Legault
> Assignee: Johannes Geppert
> Priority: Trivial
>
> Response returned by the REST plugin does not specify the character encoding. Firefox 3.6 reads the incoming JSON incorrectly for non-ANSI characters. Specifying the character encoding explicitly (;charset=utf-8) fixes the problem.
> public class JsonLibHandler implements ContentTypeHandler {
> ...
> public String getContentType() {
> return "text/javascript;charset=utf-8";
> }
> ...
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3536) Specify UTF-8 content type in
JsonLibHandler
Posted by "Jason Pyeron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037467#comment-13037467 ]
Jason Pyeron commented on WW-3536:
----------------------------------
Why was static final String DEFAULT_CONTENT_TYPE made private and not public?
> Specify UTF-8 content type in JsonLibHandler
> --------------------------------------------
>
> Key: WW-3536
> URL: https://issues.apache.org/jira/browse/WW-3536
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 2.1.8.1
> Environment: Java 5; Firefox 3.6
> Reporter: Simon Legault
> Assignee: Johannes Geppert
> Priority: Trivial
> Fix For: 2.3
>
>
> Response returned by the REST plugin does not specify the character encoding. Firefox 3.6 reads the incoming JSON incorrectly for non-ANSI characters. Specifying the character encoding explicitly (;charset=utf-8) fixes the problem.
> public class JsonLibHandler implements ContentTypeHandler {
> ...
> public String getContentType() {
> return "text/javascript;charset=utf-8";
> }
> ...
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (WW-3536) Specify UTF-8 content type in
JsonLibHandler
Posted by "Stefan Magnus Landrø (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965889#action_12965889 ]
Stefan Magnus Landrø commented on WW-3536:
------------------------------------------
We've had the same issue.
As a temporary fix, you can override the json content type handler with your own implementation (as suggested by Simon Legault).
> Specify UTF-8 content type in JsonLibHandler
> --------------------------------------------
>
> Key: WW-3536
> URL: https://issues.apache.org/jira/browse/WW-3536
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 2.1.8.1
> Environment: Java 5; Firefox 3.6
> Reporter: Simon Legault
> Priority: Trivial
>
> Response returned by the REST plugin does not specify the character encoding. Firefox 3.6 reads the incoming JSON incorrectly for non-ANSI characters. Specifying the character encoding explicitly (;charset=utf-8) fixes the problem.
> public class JsonLibHandler implements ContentTypeHandler {
> ...
> public String getContentType() {
> return "text/javascript;charset=utf-8";
> }
> ...
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.