Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Unicode Characters in ETL Strings
Unicode Characters in ETL Strings [message #590915] Mon, 26 July 2010 11:40 Go to next message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
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 #590930 is a reply to message #590915] Mon, 26 July 2010 12:02 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Andy,

We'll need to investigate this. Could you please file a bug report using
the link below and attach a minimal example that reproduces this?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=GMT& component=Epsilon

Cheers,
Dimitris

Andy wrote:
> 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 #590983 is a reply to message #590915] Thu, 29 July 2010 14:00 Go to previous messageGo to next message
Colin Snook is currently offline Colin Snook
Messages: 17
Registered: July 2009
Location: University of Southampton
Junior Member
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
Re: Unicode Characters in ETL Strings [message #591069 is a reply to message #590983] Fri, 30 July 2010 14:14 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Colin,

Thanks for your reply. I'll have a look at this as soon as possible -
which might be a bit later than usual as I'm currently on holiday. Is
this a show-stopper for your work with ETL?

Cheers,
Dimitris

On 29/07/2010 17:00, 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
Re: Unicode Characters in ETL Strings [message #638026 is a reply to message #590983] Tue, 09 November 2010 16:13 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
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
Previous Topic:EMF target model with xmi:id
Next Topic:Multiple views on the same model
Goto Forum:
  


Current Time: Wed Sep 24 04:44:56 GMT 2014

Powered by FUDForum. Page generated in 0.04674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software