Issue Details (XML | Word | Printable)

Key: SHALE-292
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Gary VanMatre
Reporter: Tom Pasierb
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Shale

Clay doesn't consider file's encoding when loading/parsing html templates from hdd

Created: 25/Sep/06 05:03 PM   Updated: 23/Jan/07 04:40 PM
Return to search
Component/s: Clay
Affects Version/s: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4-SNAPSHOT
Fix Version/s: 1.0.4

File Attachments:
  Size
HTML File Licensed for inclusion in ASF works some.html 2006-09-25 05:07 PM Tom Pasierb 0.5 kB
File Licensed for inclusion in ASF works whatever.jsp 2006-09-25 05:07 PM Tom Pasierb 1 kB
Environment: windows xp, tomcat 5.5 (started with -Dfile.encoding=UTF-8 option, this way myfaces doesn't convert all non-ascii characters to html entities), myfaces 1.1.3

Flags: Important


 Description  « Hide
Clay reads html files assuming ascii encoding. This way it's impossible to have characters other than ascii in templates. They do not display correctly. As indicated on the user mailing list a Reader object should be used for reading templates instead of InputStream. I wrote more about this on shale user mailing list.

We probably need:
1. app wide config option for setting encoding clay should use for reading templates in. Clay would default to this setting unless maybe
2. some per file encoding config option was set (something similar to @page pageEncoding directive for jsps)

I marked it as major as this should be corrected if one wants to develop localized applications with non-ascii characters in html templates.

As noted by Craig this probably also applies to xml templates, which I haven't tried myself.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #450667 Thu Sep 28 02:19:25 UTC 2006 gvanmatre Reported by Tom Pasierb - Clay doesn't consider file's encoding when loading/parsing html templates (SHALE-292).

The encoding is now determined with the following steps:
1) Look at the top of the template for the token comment containing the charset.
2) If not found, look for the app wide config option for template encoding. If found use the encoding for reading the template.
3) If not found use the vm's default "file.encoding".
4) Read the template in with the determined encoding
Files Changed
MODIFY /shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/Parser.java
ADD /shale/framework/trunk/shale-clay/src/test/java/org/apache/shale/clay/config/CharsetTestCase.java
MODIFY /shale/framework/trunk/shale-clay/src/test/java/org/apache/shale/clay/parser/ParserTestCase.java
MODIFY /shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/ClayTemplateParser.java
MODIFY /shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/parser/builder/JsfDefaultBuilder.java
ADD /shale/framework/trunk/shale-clay/src/test/resources/org/apache/shale/clay/config/some-utf-8.html
MODIFY /shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
MODIFY /shale/framework/trunk/shale-clay/src/main/resources/org/apache/shale/clay/Bundle.properties