Re: bracket syntax and UTF-8
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Sunday, August 30, 2009, 11:57:53 AM, mschipperheyn wrote: > Yeah, you are right, there as a BOM at the beginning of the file. I > had used a batch converter that inserted those. Kind of a bummer > that that isn't handled correctly. Yeah, well... in the defense of the author of the parser, I have to note that BOM's quite often cause complications elsewhere too... Whenever I write software that opens text files, I find myself writing some extra code that deals with the BOM craze. In this case, the BOM should be ignored before the [#ftl], but then re-added after it! /-: Weird. Some may will argue that it should just be ignored, etc. Not even the correct answer is 100% obvious. The next issues is then, what's if you #include that file... because you don't want a BOM in the middle of the output file (browsers has no problem with it, but if you generate something else...), only at the beginning of it. An so on... BOM's are evil. > I removed them. > > What I'm seeing though, is that if I enter arabic characters in my > freemarker template, the end result shows garbled text. I think this may > also be the reason for the BOM character being display. Yes, it shouldn't be visible in browsers. > I have > * UTF-8 freemarker templates > * UTF-8 set for CharacterEncodingFilter in web.xml > * UTF-8 database > * defaultEncoding of Spring Freemarker Config set to UTF-8 > * contentType of FreeMarkerViewResolver set to text/html;charset=UTF-8 > > Hmm, figured it out. By adding at the top [#ftl encoding="UTF-8"/] the > arabic is being displayed correctly Something is not right there... Setting defaultEncoding in the FreeMarker configuration should be definitely enough. It's highly unlikely that we don't know about a such bug if it's in FreeMarker. > Cheers, > > Marc -- Best regards, Daniel Dekany ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july