[stringtemplate-interest] Different charsets for templates

Caleb Lyness caleb.lyness at ezswitch.net
Wed Jun 13 10:25:22 PDT 2007


Hi,

Did you also look at the wiki? I have dealt with character encoding 
before....
http://www.antlr.org/wiki/display/ST/unicode_escapes

Cheers
     Caleb

> Hi. I see
>
>      /**
>       *  FIXME: Dannish does not work if typed directly in with  
> default file
>       *  encoding on windows. The character needs to be escaped as  
> bellow.
>       *  Please correct to escape the correct charcter.
>       */
> 	public void test8BitEuroChars() throws Exception {
> 		StringTemplate e = new StringTemplate(
> 				"Danish: \u0143 char"
> 			);
> 		e = e.getInstanceOf();
> 		String expecting = "Danish: \u0143 char";
> 		assertEquals(expecting, e.toString());
> 	}
>
> 	public void test16BitUnicodeChar() throws Exception {
> 		StringTemplate e = new StringTemplate(
> 				"DINGBAT CIRCLED SANS-SERIF DIGIT ONE: \u2780"
> 			);
> 		e = e.getInstanceOf();
> 		String expecting = "DINGBAT CIRCLED SANS-SERIF DIGIT ONE: \u2780";
> 		assertEquals(expecting, e.toString());
> 	}
>
> Hmm...we need to set the encoding. You need to set (in  
> StringTemplateGroup):
>
> 	/** How are the files encoded (ascii, UTF8, ...)?  You might want to  
> read
> 	 *  UTF8 for example on an ascii machine.
> 	 */
> 	String fileCharEncoding = System.getProperty("file.encoding");
>
> use setFileCharEncoding().
>
> Ter
>
> On Jun 12, 2007, at 4:42 PM, Ezra Nugroho wrote:
>
>   
>> Thank you,
>>
>> Mind giving me the test name?
>> I did some searching, but I couldn't find it.
>>
>> Thanks
>> Ezra
>>
>>
>> On Tue, 2007-06-12 at 15:57 -0700, Terence Parr wrote:
>>     
>>> Hi. THe templates should handle different encodings and unicode no
>>> problem in java.  As for attribute names, no problem. java strings.
>>>
>>> Check out the teststringtemplate.java.  It's got one test.
>>>
>>> Ter
>>> On Jun 11, 2007, at 5:17 PM, Ezra Nugroho wrote:
>>>
>>>       
>>>> StringTemplate experts,
>>>>
>>>>
>>>> I am evaluating StringTemplate for in our email manager.
>>>> One of our requirements is to be able to send email in multiple
>>>> languages, and multiple charsets.
>>>>
>>>> When I browse the API docs, it doesn't seem that I can change the
>>>> charset when setting an attribute.
>>>>
>>>> Has anyone use a different charset for attributes before?
>>>> Would StringTemplate work if the template is written in a different
>>>> charset?
>>>>
>>>>
>>>> Thank you,
>>>> Ezra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3269 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070613/cc646340/attachment.bin 


More information about the stringtemplate-interest mailing list