Re: Freemarker Encoding issue

Zhiqiang Huang <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I tried as you say, ${"\x6464"} is still output as a '?'. And I have debug
my servlet to make sure that the string in java is correct, i.e., do not
contain any '?'.
So I want to know how should I set the configuration for FreeMarker and
java.io.Writer?
Thank you.

Best regards,
hzqtc

On Tue, Mar 9, 2010 at 6:38 AM, Daniel Dekany <[email protected]> wrote:

> Monday, March 8, 2010, 5:30:23 PM, Zhiqiang Huang wrote:
>
> > Hi, there
> >
> > I'm new to freemarker and I'm using freemarker with servlet. I'm coming
> across a encoding issue.
> > If I put chinese in .ftl, it can be output correctly. But when I
> > put chinese in data-model (a hashmap), it can't. The Chinese characters
> are output as '?'.
> > I have tried all the setxxxEncoding methods to set the encoding to
> "utf-8" and failed.
> > Could anyone help me? Thank you very much!
>
> Put a ${"\x6464"} into your template. If in the browser it shows a "?"
> instead of a chinese character, then something is still wrong with the
> FreeMarker configuration and/or with the java.io.Writer where
> FreeMarker prints its output. If ${"\x6464"} shows a chinese
> character, and also the chiense text entered directly into the
> template shows correctly, then most probably it's the connection to
> the data-base server that has an encoding issue. (You can double-check
> that if in Java (not in FreeMarker) you log the character codes of the
> string... if it contains 63-s, which is the code of '?', the it
> already contains the '?'-s when you receive it from the database.)
>
> > Best wishes,
> > hzqtc
> --
> Best regards,
>  Daniel Dekany
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.