[stringtemplate-interest] Re: unicode and stringtemplate

Terence Parr parrt at cs.usfca.edu
Fri Jan 20 09:58:14 PST 2006


On Jan 19, 2006, at 6:29 PM, Kien Te Do wrote:

> Hi Terence,
>
> I am not sure I have a right answer. My box's Location is US and
> Language is English. However I try to put some Vietnamese  
> characters to
> template file, so that I saved my template file with Unicode encode.
> Actually, I set my java editor to use Unicode also.

Ok, this is the problem.  The default is to use the boxes location to  
determine what kind of files are on the machine.  Use

	public void setFileCharEncoding(String fileCharEncoding) {
		this.fileCharEncoding = fileCharEncoding;
	}

method in StringTemplateGroup to alter the file encoding.  here is  
the def of that field:

	/** How are the files encode (ascii, UTF8, ...)?  You might want to  
read
	 *  UTF8 for example on a ascii machine.
	 */
	String fileCharEncoding = System.getProperty("file.encoding");

Terence


More information about the stringtemplate-interest mailing list