1 From: nvelocity-user-admin@lists.sourceforge.net on behalf of Mike
2 Bridge [mike@mymailout.com]
3 Sent: Friday, December 31, 2004 1:35 PM
4 To: nvelocity-user@lists.sourceforge.net
5 Subject: [NVelocity-user] Problem with reading latin-1 accented chars
7 I'm having a problem reading accented characters from a template with the last NVelocity release version. I'm certain that the template itself is encoded in iso-8859-1, and I'm explicitly reading it with that encoding. The accented characters are being removed entirely. (My nvelocity.properties file also has the line
8 "input.encoding=ISO-8859-1".)
10 I can't quite see where this is going wrong.... Any ideas?
16 NVManager.VelocityInit();
18 catch (System.Exception e)
20 log.Error("Problem initializing Velocity : " + e);
21 Assert.Fail("Could not initialize velocity");
24 VelocityContext context = new VelocityContext();
26 StringWriter writer = new StringWriter();
30 Velocity.MergeTemplate("Tests\\accentedchars.vm", "iso-8859-1", context, writer);
32 catch (System.Exception e)
34 log.Error(e.StackTrace);
35 log.Error("Problem merging template : " + e);
36 Assert.Fail("Problem merging template");
38 String result=writer.ToString();
40 //log.Debug("FOUND "+result);
41 Assert.IsTrue(result.IndexOf("àéèç") > 0);
42 Assert.IsTrue(result.IndexOf("äøæå") > 0);
46 And this is what's in the "accentedchars.vm" template:
49 TEST ISO-8859-1 ACCENTS
65 -------------------------------------------------------
66 The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
67 It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
68 _______________________________________________
69 NVelocity-user mailing list
70 NVelocity-user@lists.sourceforge.net
71 https://lists.sourceforge.net/lists/listinfo/nvelocity-user