• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Velocity Template is not encoding charecter,instead throwing an error message.

 
Greenhorn
Posts: 2
Google Web Toolkit Eclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using velocity template to send email(In chinese language).So using hexa decimal charecter in template.But am getting some lexical error.
Here i have shown both normal java code implementation and template implemnetation.

Here in the above normal java piece of code, \"\u8bf7\u6c42:\" will encode properly in to Chinese character.

But if I use same \"\u8bf7\u6c42:\" in velocity template(eml.vsl) using

$message.setSubject(\"\u8bf7\u6c42:\")

Note-message is an object of class EmailMsg

it is throwing java.lang.Exception: Error processing velocity script:
Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 59, column 11. Encountered: "\"" (34), after : "\\"

Can anyone let me know what could be the fix for it.

Thanks in Advance,
Priya Gowda.
 
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi - is SimpleValue your custom class or it's present in some other jar. I am facing compilation issues.
 
Priya Gowda
Greenhorn
Posts: 2
Google Web Toolkit Eclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response!


This works fine as i give the input(hex code) in simple java.

but i have problem in reading the same input from velocity template.i read the template from sample java code as below and template has that hexadecimal charecter.


after line number 5 it throws a lexical error mentioned in my query.
Thanks!

 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

You will have to find out why the Template does not allow quote marks after that backslash. It is obviously something to do with the permitted types of text in Velocity.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic