On Fri, Jan 22, 2010 at 1:03 PM, <lind...@inuus.com> wrote:

>
> http://codereview.appspot.com/186278/diff/1/2
> File
>
> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java
> (right):
>
> http://codereview.appspot.com/186278/diff/1/2#newcode119
>
> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java:119:
> encoding = "UTF-8";
> On 2010/01/22 18:16:57, beaton wrote:
>
>> Why would we ever receive a request that was not UTF-8 encoded?
>>
>
> From the HttpServletRequest javadoc:
>
> Returns the name of the character encoding used in the body of this
> request. This method returns null if the request does not specify a
> character encoding
>
>
> http://codereview.appspot.com/186278/diff/1/2#newcode129
>
> java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java:129:
> req.setPostBody(getParameter(request, POST_DATA_PARAM,
> "").getBytes(encoding));
> On 2010/01/22 18:16:57, beaton wrote:
>
>> paul lindner ran into nasty performance problems with code like this:
>>
>
>
>
> http://paul.vox.com/library/post/the-mysteries-of-java-character-set-performance.html
>
> If the other character set is only used sporadically, then yes, you'll
> be okay.  Since most sites will tend to stick with one or the other
> character set this should be okay.  Id recommend passing the charset
> value through a toUpperCase to reduce variance though...


Good suggestion, and "other" charsets *should *only be used sporadically.
Still, they might not, which leads me to ask the inevitable: what are the
hurdles in Shindig upgrading to Java 6?

And I quote Mr Lindner:
"If you're using Java 6 you can use pre-calculated static Charset objects
which gets you more concurrency. This works for getBytes() and some others.
Of course this doesn't help with external class libraries... I added this to
our local copy of the postgresql jdbc driver and it helped out a bit."

...among likely other benefits.


>
>
> http://codereview.appspot.com/186278/show
>

Reply via email to