views:

347

answers:

1

I have a velocity/html file. I'm trying to include/parse some simple HTML into a page.

If I just copy the text directly on the the main file, it works fine:

Miranda Kerr hasn’t been a Victoria’s Secret Angel for ...

If I create a separate VM file, and include it like so:

#parse("topicoftheday/homepagenews.vm")

I get bad character garbage:

Miranda Kerr hasn’t been a Victoria’s Secret Angel for

How? Why?

Thanks

+1  A: 

Looks like you have 3 encodings used,

  1. The VM file in UTF-8.
  2. The Velocity in Latin-1.
  3. The terminal/JVM in ANSI.

You are using the non-ASCII apostrophe U+2019. The UTF-8 sequence is E2 80 19, happens to be the 3 chars you see in Latin-1 displayed as ANSI.

You need to change all of them to UTF-8 because Latin-1/ANSI don't have this character. Or you should use ASCII apostrophe '.

For velocity, set this parameter,

input.encoding = UTF-8
ZZ Coder
The content comes from an external RSS feed so I can't change the apostrophe. But I'm looking into changing the parameters ...
nute