[Resin-interest] Character encoding in root vs included JSP
I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
On 2/28/14, 4:47 AM, Rick Mann wrote: Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. I believe that's correct, though. The top page is responsible for deciding encoding. -- Scott On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
On Feb 28, 2014, at 08:55 , Scott Ferguson f...@caucho.com wrote: On 2/28/14, 4:47 AM, Rick Mann wrote: Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. I believe that's correct, though. The top page is responsible for deciding encoding. I found I need to include it in both the top page, AND the page that gets included. Wish there were a way to just set it once for the whole container. -- Scott On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
Traditionally the JSP spec has mandated ISO-8859-1 if nothing else is explicitly specified. However I notice recent versions have a facility to specify it more broadly in web.xml Case in point is section JSP.3.3.4 in version 2.2 of the spec: http://download.oracle.com/otn-pub/jcp/jsp-2.2-mrel-eval-oth-JSpec/jsp-2_2-mrel-spec.pdf The syntax would look something like jsp-property-group url-pattern/*/url-pattern page-encodingUTF-8/page-encoding /jsp-property-group I haven't used JSPs in years, and have no idea of whether Resin supports this. Knut Forkalsrud On Fri, Feb 28, 2014 at 11:41 AM, Rick Mann rm...@latencyzero.com wrote: On Feb 28, 2014, at 08:55 , Scott Ferguson f...@caucho.com wrote: On 2/28/14, 4:47 AM, Rick Mann wrote: Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. I believe that's correct, though. The top page is responsible for deciding encoding. I found I need to include it in both the top page, AND the page that gets included. Wish there were a way to just set it once for the whole container. -- Scott On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
You could also use a jsp prelude to include whatever directives you need. A bit of a hack, but it gets the job done. Sent from my cool new iPad Mini On Feb 28, 2014, at 3:22 PM, Knut Forkalsrud knut-cau...@forkalsrud.org wrote: Traditionally the JSP spec has mandated ISO-8859-1 if nothing else is explicitly specified. However I notice recent versions have a facility to specify it more broadly in web.xml Case in point is section JSP.3.3.4 in version 2.2 of the spec: http://download.oracle.com/otn-pub/jcp/jsp-2.2-mrel-eval-oth-JSpec/jsp-2_2-mrel-spec.pdf The syntax would look something like jsp-property-group url-pattern/*/url-pattern page-encodingUTF-8/page-encoding /jsp-property-group I haven't used JSPs in years, and have no idea of whether Resin supports this. Knut Forkalsrud On Fri, Feb 28, 2014 at 11:41 AM, Rick Mann rm...@latencyzero.com wrote: On Feb 28, 2014, at 08:55 , Scott Ferguson f...@caucho.com wrote: On 2/28/14, 4:47 AM, Rick Mann wrote: Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. I believe that's correct, though. The top page is responsible for deciding encoding. I found I need to include it in both the top page, AND the page that gets included. Wish there were a way to just set it once for the whole container. -- Scott On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Character encoding in root vs included JSP
Thank you. Adding this: jsp-config jsp-property-group url-pattern*.jsp/url-pattern page-encodingUTF-8/page-encoding /jsp-property-group /jsp-config To the bottom of my web.xml seems to have done the trick. Initially, I had the url-pattern /*, but that broke the mapping of / (which was supposed to be handled by Spring WebMVC; I find it very fragile, the routing of a request through a servlet container). On Feb 28, 2014, at 12:21 , Knut Forkalsrud knut-cau...@forkalsrud.org wrote: Traditionally the JSP spec has mandated ISO-8859-1 if nothing else is explicitly specified. However I notice recent versions have a facility to specify it more broadly in web.xml Case in point is section JSP.3.3.4 in version 2.2 of the spec: http://download.oracle.com/otn-pub/jcp/jsp-2.2-mrel-eval-oth-JSpec/jsp-2_2-mrel-spec.pdf The syntax would look something like jsp-property-group url-pattern/*/url-pattern page-encodingUTF-8/page-encoding /jsp-property-group I haven't used JSPs in years, and have no idea of whether Resin supports this. Knut Forkalsrud On Fri, Feb 28, 2014 at 11:41 AM, Rick Mann rm...@latencyzero.com wrote: On Feb 28, 2014, at 08:55 , Scott Ferguson f...@caucho.com wrote: On 2/28/14, 4:47 AM, Rick Mann wrote: Hmm. Seems like if I %@ include a file that contains %@ page contentType=text/html; charset=UTF-8% Then it doesn't work. If I include that @ page line directly, it gets the encoding right. I believe that's correct, though. The top page is responsible for deciding encoding. I found I need to include it in both the top page, AND the page that gets included. Wish there were a way to just set it once for the whole container. -- Scott On Feb 28, 2014, at 04:45 , Rick Mann rm...@latencyzero.com wrote: I thought I had UTF-8 set throughout my app; source files are encoded in it, I set it everywhere I can think of (requests, responses, JVM, HTML and JSP tags). I we re-doing the HTML for my site, fancifying it with bootstrap and all that goodness, when I noticed that the copyright symbol I typed wasn't rendering correctly. It used to with the old HTML, so I investigated. Turns out, it only renders correctly if I jsp:include the HTML snippet that contains the symbol. If it's typed directly into the page, it doesn't work. Any ideas? Thanks! -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest -- Rick signature.asc Description: Message signed with OpenPGP using GPGMail ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
Jeff Schnitzer schrieb: I wrote up a quick blurb on the issues surrounding character encoding on the Resteasy list recently: http://sourceforge.net/mailarchive/message.php?msg_name=540eb7210908281001r6aafaa55u78615debb704e4c1%40mail.gmail.com Good blurb! The main problem is that POSTed form data will be sent by the browser in whatever charset encoding was used on the host page, and this information is not sent along with the request. So the server must guess... and that usually means going with the platform default. On the page you're referring to: * If there is an acceptcharset element on the form, it should submit with that encoding. I've never tested this. * Otherwise the browser will submit with whatever encoding the page was rendered in. That's not quite what the HTML spec says: accept-charset = charset list [CI] This attribute specifies the list of character encodings for input data that is accepted by the server processing this form. The value is a space- and/or comma-delimited list of charset values. The client must interpret this list as an exclusive-or list, i.e., the server is able to accept any single character encoding per entity received. The default value for this attribute is the reserved string UNKNOWN. User agents may interpret this value as the character encoding that was used to transmit the document containing this FORM element. http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset So there is must and may instead of should and will. But I've never tested it either. And tests would have to be done against multiple implementations, not against the spec :-/ Maybe worth trying, though. -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
No, I mean in the request... on the java side. On Wed, Sep 23, 2009 at 6:07 PM, Rick Mann rm...@latencyzero.com wrote: In a JSP? %@ page pageEncoding=UTF-8 % On Sep 23, 2009, at 12:14:35, Rom Sok wrote: Hi, Is there a way to force URI CHARACTER encoding to UTF-8? Thanks ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
Rom Sok schrieb: Is there a way to force URI CHARACTER encoding to UTF-8? No, I mean in the request... on the java side. That's poor and inefficient communication. Consider giving a complete description of what you want to achieve and how it relates to Resin. Reading this might help you in doing so: http://catb.org/~esr/faqs/smart-questions.html -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
Sorry, let's try this again: I am running into a problem where certain UTF-8 characters go into the application and come out as nonsense. The JSP's are using UTF-8 encoding, and so does the database. Accoridng to my research one of the things I have to do on the application side to make sure character encoding is always consistent is set the character encoding in the server configuration for URL-decoding GET request parameters. The equivalent in Tomcat configuration is *Connector (...) URIEncoding=UTF-8 /* Is there an equivalent in Resin? Thanks. On Thu, Sep 24, 2009 at 10:01 AM, Michael Ludwig m...@as-guides.com wrote: Rom Sok schrieb: Is there a way to force URI CHARACTER encoding to UTF-8? No, I mean in the request... on the java side. That's poor and inefficient communication. Consider giving a complete description of what you want to achieve and how it relates to Resin. Reading this might help you in doing so: http://catb.org/~esr/faqs/smart-questions.htmlhttp://catb.org/%7Eesr/faqs/smart-questions.html -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
Rom Sok schrieb: I am running into a problem where certain UTF-8 characters go into the application and come out as nonsense. Do you know the source of these characters, or maybe bytes? Application source code? Incoming HTTP request? Might you be relying on the platform's default charset (encoding)? Is your default charset indeed UTF-8? Consider: * String(byte[] bytes) - relying on the default charset here! * String(byte[] bytes, String charsetName) * String(byte[] bytes, Charset charset) java.nio.charset.Charset.defaultCharset().displayName() Accoridng to my research one of the things I have to do on the application side to make sure character encoding is always consistent is set the character encoding in the server configuration for URL-decoding GET request parameters. Is your HTML output also UTF-8? Or maybe rather ISO-8859-1, the default? The equivalent in Tomcat configuration is *Connector (...) URIEncoding=UTF-8 /* Is there an equivalent in Resin? Don't know, would have to look it up in the docs. -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
On Sep 24, 2009, at 7:59 AM, Rom Sok wrote: Sorry, let's try this again: I am running into a problem where certain UTF-8 characters go into the application and come out as nonsense. The JSP's are using UTF-8 encoding, and so does the database. Accoridng to my research one of the things I have to do on the application side to make sure character encoding is always consistent is set the character encoding in the server configuration for URL-decoding GET request parameters. The equivalent in Tomcat configuration is Connector (...) URIEncoding=UTF-8 / Resin should default to utf-8. The configuration is resin ... cluster id= url-character-encodingutf-8/url-character-encoding /cluster .. /resin There's also a character-encodingutf-8/character-encoding which affects all default character encodings in Resin, including POST parsing. JSP can be a bit tricky, though, because the JSP default is ISO-8859-1 (unfortunate, but it's part of the JSP spec.) The character- encoding should override the JSP default. -- Scott Is there an equivalent in Resin? Thanks. On Thu, Sep 24, 2009 at 10:01 AM, Michael Ludwig m...@as-guides.com wrote: Rom Sok schrieb: Is there a way to force URI CHARACTER encoding to UTF-8? No, I mean in the request... on the java side. That's poor and inefficient communication. Consider giving a complete description of what you want to achieve and how it relates to Resin. Reading this might help you in doing so: http://catb.org/~esr/faqs/smart-questions.html -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
On Sep 24, 2009, at 9:13 AM, Rom Sok wrote: Thanks, Where does character-encodingutf-8/character-encoding go? In resin.conf? If so, what's the nesting? I.e. inside what tags is it nested. It's actually contextual, though the cluster is the best place for it, because URL parsing happens at the cluster level. -- Scott Thank you, R.S. On Thu, Sep 24, 2009 at 12:03 PM, Scott Ferguson f...@caucho.com wrote: On Sep 24, 2009, at 7:59 AM, Rom Sok wrote: Sorry, let's try this again: I am running into a problem where certain UTF-8 characters go into the application and come out as nonsense. The JSP's are using UTF-8 encoding, and so does the database. Accoridng to my research one of the things I have to do on the application side to make sure character encoding is always consistent is set the character encoding in the server configuration for URL-decoding GET request parameters. The equivalent in Tomcat configuration is Connector (...) URIEncoding=UTF-8 / Resin should default to utf-8. The configuration is resin ... cluster id= url-character-encodingutf-8/url-character-encoding /cluster .. /resin There's also a character-encodingutf-8/character-encoding which affects all default character encodings in Resin, including POST parsing. JSP can be a bit tricky, though, because the JSP default is ISO-8859-1 (unfortunate, but it's part of the JSP spec.) The character-encoding should override the JSP default. -- Scott Is there an equivalent in Resin? Thanks. On Thu, Sep 24, 2009 at 10:01 AM, Michael Ludwig m...@as- guides.com wrote: Rom Sok schrieb: Is there a way to force URI CHARACTER encoding to UTF-8? No, I mean in the request... on the java side. That's poor and inefficient communication. Consider giving a complete description of what you want to achieve and how it relates to Resin. Reading this might help you in doing so: http://catb.org/~esr/faqs/smart-questions.html -- Michael Ludwig ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
I wrote up a quick blurb on the issues surrounding character encoding on the Resteasy list recently: http://sourceforge.net/mailarchive/message.php?msg_name=540eb7210908281001r6aafaa55u78615debb704e4c1%40mail.gmail.com The short of it is that, if you can get away with it, you should set UTF-8 everywhere. In particular, you should set the platform default with -Dfile.encoding=utf-8 and ensure that all your pages are rendered in utf-8 (ie with the JSP directive). It's cool that Resin has a config parameter for this, but it will be obviated by setting the platform default - right, Scott? The main problem is that POSTed form data will be sent by the browser in whatever charset encoding was used on the host page, and this information is not sent along with the request. So the server must guess... and that usually means going with the platform default. If you for some reason need to manage multiple charsets in the same application, you'll need a Filter that executes early and calls request.setCharacterEncoding() *before* any code calls request.getParameter(). Jeff ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
[Resin-interest] character encoding
Hi, Is there a way to force URI CHARACTER encoding to UTF-8? Thanks ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] character encoding
In a JSP? %@ page pageEncoding=UTF-8 % On Sep 23, 2009, at 12:14:35, Rom Sok wrote: Hi, Is there a way to force URI CHARACTER encoding to UTF-8? Thanks ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest