Unicode Characters in ETL Strings [message #590915] |
Mon, 26 July 2010 07:40  |
Eclipse User |
|
|
|
Hi,
I wish to create a string in my target model that uses characters from the Unicode character set. In the ETL source I write,
pcInv.predicate := pcVar.name + " ∈ " + pcSet.name;
Currently the string that is output by my ETL translation does not correctly contain the Unicode character.
However, I also use Unicode characters in my source model, and they do get translated correctly (in this case they are just copies of the source) .
Any idea how to write Unicode in ETL strings so that they translate to Unicode in the target model?
Andy
|
|
|
|
|
|
Re: Unicode Characters in ETL Strings [message #638026 is a reply to message #590983] |
Tue, 09 November 2010 11:13  |
Eclipse User |
|
|
|
Hi Colin,
This has been resolved offline with Andy. The solution is to define the
following toUnicode() operation
operation String toUnicode() {
var unicode = Native("java.lang.Integer").parseInt(self, 16);
var chars = Native("java.lang.Character").toChars(unicode);
return Native("java.util.Arrays").toString(chars).substring(1,2);
}
and rewrite the statement in question as follows
var predicate = "e " + "2208".toUnicode() + " S";
Cheers,
Dimitris
Colin Snook wrote:
> Hi,
> I also need to construct unicode maths in ETL. For example e ∈ S
> requires the memberof symbol. In Java I would write this using the
> escape code \ and unicode character number u2208 i.e.
> var predicate = "e \u2208 S
>
> However, it seems ETL cannot parse correctly with escape characters in
> strings. It gives me incorrect error messages as soon as I put \ in a
> string.
>
> I also tried using the character directly but this does not work either.
>
> Colin
|
|
|
Powered by
FUDForum. Page generated in 0.06693 seconds