UnicodeFileResourceLoader:
http://koti.mbnet.fi/akini/java/unicodereader/
You could try using UnicodeFileResourceLoader and
always save your .vm templates as UTF-8 files.
Actually you should use UTF-8 with bom marker format.
It is what windows Notepad does when saving utf8
files.
Or you may use
I have own servlet where I handle requests. I try to
create all webapps as UTF-8 enabled, no options
allowed. Even all config files are stored as
utf-8_with_bom files :-)
I use my UnicodeReader to read all .properties files
and .vm files. I save files as UTF-8_withBOM text
files, Windows Notepad
About copying velocity.jar to tomcat/common/lib
folder. Did you put StringResourceLoader.class to
webapps/mywebapp/WEB-INF/lib/xxx.jar package (or
WEB-INF/classes folder)?
If yes then maybe it was about the ClassLoader
instance that was giving your problems. common/lib
classes are loaded by a
Where I use Velocity tools is not rendering html
pages. I solely use it as sql rendering utility. I
have template files where I have sql queries. I use
velocity to create the final sql formula string and
run it against the database.
And applications are nothing to do with Tomcat, JSP,
servlet
As always in _Java_, use / path separator even in
Windows. This way its portable across *Nix and Win
platforms. And secondly, you dont have to escape path
separator. \t might map to TAB character.
file.resource.loader.path = c:/templates
--- M. Hossein Amerkashi [EMAIL PROTECTED] wrote:
Hi,
See this JIRA document. I will reevaluate my
contribution (still havent dont it) and submit it to
Velocity1.5 codebase.
But you should fine UnicodeResourceLoader custom class
and example application. Maybe it helps you resolve
the why velocity.properties did not work for you.
://koti.mbnet.fi/akini/java/unicodereader/
--- Pham Anh Tuan [EMAIL PROTECTED] wrote:
Thank you Nathan and mailmur, my problem is
solved, it's just because I
only saved properties file under UTF-8 with content
like: tôi yêu Viá»t Nam,
so it's not showed correctly. So, to let everything
Is your properties file read as UTF-8 encoded text
file?
You could test this like the following:
Properties p = read your propfile as you do now
if (p.getProperty(hello).equalsIgnoreCase(\u_
encoded_value)) { System.out.println(match ok); }
This makes sure you have got the value correctly,
.
UnicodeFileResourceLoader uses a customized
InputStream implementation to skip utf8 bom marker
bytes.
t. Mailmur
From JIRA page:
Hi Mailmur. I'm going through some old issues. Thanks
for contributing this. Sorry it's been such a long
time. Would you be willing to place this code (or a
link to your web page
In the meantime you can download the nightly
snapshot of the source code
here:
http://cvs.apache.org/snapshots/velocity/
Check out the changelog for the latest list of items
added.
I've always wanted to see whats been changed prior to
my local subversion and server versions. Is there
I probably get changes
later in a update command.
--- Will Glass-Husain [EMAIL PROTECTED] wrote:
Hi Mailmur,
Thanks again for doing this. Do you have the
command line svn client
installed? You should be able to cd to the root
Velocity directory, then
type at the command line
svn
build.xml changes:
manifest.mf file: It is like windows
secondaryClick/Version tabsheet information where we
can see version info etc.
See my webpage zipfile, where you should find
src/META-INF/MANIFEST.MF file. I believe diff did not
include it (just realized).
So to summarize:
* meaninfull
The following changes where made
* added src/java/META-INF/MANIFEST.MF file
_all_ java packages should have a _meaninfull_
manifest file. This is a sort of win exefile's
VersionInfo tabsheet and is really a good quality of
service.
* modified build/build.xml file
and create a
patch. If ant test passes I'll commit it straight
away.
- Original Message -
From: mailmur [EMAIL PROTECTED]
org\apache\velocity\runtime\resource\loader\FileResourceLoader.java
This class uses Vector and Hashtable instances to
store cached paths values. Should
Here is a small standalone test program, It uses my
customized UnicodeFileResourceLoader. But it should
give you a good example how to use it outside of any
app server.
http://koti.mbnet.fi/akini/java/unicodereader/
I have actually used Velocity as a sql query
generator. I have sql template files
File:
org\apache\velocity\runtime\resource\loader\FileResourceLoader.java
This class uses Vector and Hashtable instances to
store cached paths values. Should this and other
classes be converted to use ArrayList and HashMap
instances?
I think ArrayList+Hashmap give better runtime performance.
On Friday 11 February 2005 17:45, Shinobu Kawai
wrote:
It's all Java stuff. Java stores data in memory
as Unicode, so
everything going into Java must be converted into
Unicode. Currently,
there is no way Java can tell whether a file is
ascii or Greek or
Japanese or whatever. So,
Velocity supports unicode fine without my resource
reader.
Due to a java bug cannot handle UTF-8 bommarker
properly. So, I've created a UnicodeFileResourceLoader
to support UTF-8 bommarker. See my webpage for a small
test program.
http://koti.mbnet.fi/akini/java/unicodereader/
If you use Windows
18 matches
Mail list logo