rasyahadlinugraha / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
0 stars 0 forks source link

Language files for UI Datepicker are missing the charset #265

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Configure the application using an ISO encoding as default
protected void init() {
...
   getRequestCycleSettings().setResponseRequestEncoding("ISO-8859-1");
...
}

2.Add a datepicker to a page
3.Force the application Locale to Locale.FRENCH in the session.

What is the expected output? What do you see instead?
The accent characters (months name for example) are not well renderer in the 
browser.

What version of the product are you using? On what operating system?
6.0.0

I successfully fix the problem replacing this line in the renderHead method of 
the DatePicker component:
  response.render(JavaScriptHeaderItem.forReference(dpl));
with this line
  response.render(JavaScriptHeaderItem.forReference(dpl, null, null, false, "UTF-8"));

[1] http://code.google.com/p/wiquery/wiki/Quickstart15

Original issue reported on code.google.com by mathieu....@gmail.com on 21 Feb 2013 at 6:15

Attachments:

GoogleCodeExporter commented 9 years ago
You are messing around with encodings. If you want the accent characters to 
render properly everywhere you need the entire response to be "UTF-8". 
"ISO-8859-1" sucks and can only handle the basic characters.

Original comment by hielke.hoeve on 26 Nov 2013 at 8:50

GoogleCodeExporter commented 9 years ago
I agree that ISO-8859-1 sucks, but that's not the point. The JS file you serve 
for the DatePicker is encoded using UTF-8, so you should specify the encoding 
while serving the file, otherwise it falls back to the request cycle default 
encoding which might not be UTF-8.

Original comment by mathieu....@gmail.com on 26 Nov 2013 at 2:06

GoogleCodeExporter commented 9 years ago
Which JS file you mean?

Original comment by reier...@gmail.com on 26 Nov 2013 at 2:35

GoogleCodeExporter commented 9 years ago
The file that is behind the DatePickerLanguageResourceReference. 

In DatePicker.java, you add a JS reference to the header.
DatePickerLanguageResourceReference dpl =
DatePickerLanguageResourceReference.get(getLocale());
if (dpl != null)
    response.render(JavaScriptHeaderItem.forReference(dpl));

Adding this file using a UTF-8 encoding solve the problem:
response.render(JavaScriptHeaderItem.forReference(dpl, null, null, false, 
"UTF-8"));

Original comment by mathieu....@gmail.com on 26 Nov 2013 at 5:04