On 8/8/07, Gary M. Catlin <[EMAIL PROTECTED]> wrote: > Thank you for the reply, but not sure if that will help. My solution > needs to be at a higher level. I need to "set" a variable with a unicode > value, and to output this value before and after a block of output: > > #set ($v = "\uf00b")
Unfortunately, this was broken. It has been fixed in Velocity 1.6 though. https://issues.apache.org/jira/browse/VELOCITY-520 If you aren't interested in building 1.6 from source yourself (it has no releases yet), then you could create a "tool" that creates arbitrary unicode characters for you. Since i was curious of how to do this myself, i wrote one for you: public class UnicodeTool { public static String get(String code) { if (code != null && code.startsWith("\\u")) { code = code.substring(2, code.length()); } return get(Integer.valueOf(code,16)); } public static String get(int codePoint) { return String.valueOf(Character.toChars(codePoint)); } } Just put an instance in the context as "unicode" and use it in the template like this: #set( $v = $unicode.get('f00b') ) > $v > $myBlockOutput > $v > > The problem has been assigning the unicode value. The standard 'escape' > does not seem to be working. We are using Velocity 1.5. > > Thank you. > > > mailmur wrote: > > http://koti.mbnet.fi/akini/java/unicodereader/ > > http://koti.mbnet.fi/akini/java/java_utf8_xml/ > > > > Velocity 1.5+ has UnicodeFileResourceLoader loader > > implementation. You can save .vm files as UTF-8 (with > > or without BOM) text files. It saves you all the > > troubles. > > > > Only issue then is to make sure you send HttpResponse > > headers accordingly. > > Content-Type: text/html; charset=UTF-8 > > > > --- "Gary M. Catlin" <[EMAIL PROTECTED]> wrote: > > > > > >> How do I assign and output a unicode character in > >> velocity? I need to > >> output the value of "f00b" prior to a block of > >> calculated output. > >> > >> TIA > >> > > > > > > > > > > ____________________________________________________________________________________ > > Pinpoint customers who are looking for what you sell. > > http://searchmarketing.yahoo.com/ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
