Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » character entity in the input model gets substituted in the generated file even if it's xml/xhtml
character entity in the input model gets substituted in the generated file even if it's xml/xhtml [message #55714] Mon, 19 January 2009 13:00 Go to next message
Edoardo Comar is currently offline Edoardo Comar
Messages: 102
Registered: July 2009
Senior Member
I have one input model where some text node contains the character
entity registered trademark
®

the generated files include xhtml files and javadoc comment which gets
the text via <c:get select="...">
but there the entity is replaced with its actual value which depends on
the platform encoding

the result is that text generated on linux has a nonprintacble char in
windows and viceversa.

how could we have that character entity output verbatim in the generated
text ?
Re: character entity in the input model gets substituted in the generated file even if it's xml/xhtm [message #55742 is a reply to message #55714] Mon, 19 January 2009 15:44 Go to previous message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Edoardo:

Here's what's happening...

1) On reading the &#174; entity, the XML parser translates this into the
corresponding unicode character.
2) your c:get tag writest that Unicode character to the JET writer
3) when ws:file actually saves the contents, it tries to figure out what
encoding to use. Up until very, very recently, if no encoding was specfied,
JET would ask the platform/workspace what encoding to use. About a week ago,
I added a check with the content type manager, to see if the platform had a
registered content type that could figure out an encoding. You are
generating XHTML, which has several content-based methods of specifying
encoding. But, the content type that understand this are only available in
webtools, not the base platform. So, unless you have Webtools installed, JET
is still falling back to the platform's default encoding, which, as you are
finding, is different on linux and windows.

The easiest way to get things to happen the way you want it to explicitly
specify the encoding on ws:file. I think your XHTML template is specifying
UTF-8, so add that as the value of the encoding attribute of ws:file as
well.

Paul


"Edoardo Comar" <ecomar@uk.ibm.com> wrote in message
news:gl2f3e$6j2$1@build.eclipse.org...
>I have one input model where some text node contains the character entity
>registered trademark
> &#174;
>
> the generated files include xhtml files and javadoc comment which gets the
> text via <c:get select="...">
> but there the entity is replaced with its actual value which depends on
> the platform encoding
>
> the result is that text generated on linux has a nonprintacble char in
> windows and viceversa.
>
> how could we have that character entity output verbatim in the generated
> text ?
Previous Topic:[Announce] M2T XPAND 0.7.0 I200901151131 is available
Next Topic:JET: accessing JET variables from inline java
Goto Forum:
  


Current Time: Thu Apr 24 15:03:46 EDT 2014

Powered by FUDForum. Page generated in 0.01788 seconds