Make wicket encode its fortunes response in UTF-8#2662
Make wicket encode its fortunes response in UTF-8#2662michaelhixson wants to merge 1 commit intoTechEmpower:masterfrom
Conversation
It appeared to be using the system default charset instead, which was not necessarily UTF-8. Changing the TEXT_HTML constant to "text/html;charset=utf-8" also would have fixed it, but this solution involves fewer lines of code and seems (to me) like more idiomatic wicket application code. I removed the renderXmlDecl() override for a similar reason (fewer lines, seems more idiomatic) although it had nothing to do with the UTF-8 issue. I removed the initialCapacity argument for the ArrayList because there's no good reason to set it to 10,000. Since the test requirements state that the list shouldn't be sized using foreknowledge of the row count, we might as well trust ArrayList's defaults.
Idiomatic code is also to use something like The changes you revert in this PR are done intentionally to reduce the response size to the required minimum. About ArrayList size: I don't remember any requirements about its initial size, but I also do not re-read the requirements very often. Please do not remove |
|
Ok, I'll make a new PR. |
This should repair the wicket fortune test on ServerCentral, which is currently failing.
It appeared to be using the system default charset instead, which was not necessarily UTF-8.
Changing the
TEXT_HTMLconstant to"text/html;charset=utf-8"also would have fixed it, but this solution involves fewer lines of code and seems (to me) like more idiomatic wicket application code.I removed the
renderXmlDecl()override for a similar reason (fewer lines, seems more idiomatic) although it had nothing to do with the UTF-8 issue.I removed the
initialCapacityargument for theArrayListbecause there's no good reason to set it to 10,000. Since the test requirements state that the list shouldn't be sized using foreknowledge of the row count, we might as well trustArrayList's defaults.