Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316286

Summary: String Character Encoding gets mixed up through .toLowerCase()
Product: [Modeling] M2T Reporter: Matthias Vianden <matthias.vianden>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource, matthias.vianden
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Matthias Vianden CLA 2010-06-09 09:07:39 EDT
Build Identifier:  I20100527-1700

If you have an Xpand Script to replace characters, than the following statement will work correctly:
"צה�".replaceAll("ה","ae") ==> "צae�"
Whereas the following will not work:
"צה�".toLowerCase().replaceAll("ה", "ae") ==> "צה�"

See the following link for a more detailed discussion and a demo project (the discussion is in German!)
http://oaw-forum.itemis.de/forum/viewtopic.php?forum=1&showtopic=2213

Reproducible: Always

Steps to Reproduce:
See Dateils above and the demo project at: http://www.swc.rwth-aachen.de/DOCUMENTS/utf8test.zip
Comment 1 Karsten Thoms CLA 2012-11-29 15:50:08 EST
This is an encoding issue. The ResourceLoaderDefaultImpl#createReader() tries to detect the encoding by heuristics. While the XPT file is correctly identified as UTF-8, this fails for the EXT file, which is recognized as ISO-8859-1.

The input file encoding must be set through the ResourceManager, like follows:

	component = org.eclipse.xpand2.Generator {
		fileEncoding="UTF-8"
		metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
		expand = expand
		outlet = {
			path = targetDir
			fileEncoding="UTF-8"
			postprocessor = org.eclipse.xtend.typesystem.xsd.XMLBeautifier {
			}
		}
		resourceManager = org.eclipse.xtend.expression.ResourceManagerDefaultImpl {
		    fileEncoding = "UTF-8"
		}
	}


See also "Generator Workflow Configuration: Encoding" of Xpand manual.
Comment 2 Eclipse Webmaster CLA 2017-10-31 11:26:16 EDT
Requested via bug 522520.

-M.