Automatically escape cyrillic characters

View: New views
6 Messages — Rating Filter:   Alert me  

Automatically escape cyrillic characters

by Benjamin Muschko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using Castor and want to automatically get escaped cyrillic characters when marshalling my bean (e.g. Д). I'm using a StringWriter as input for the marshaller. The resulting XML includes escaped sequences for > and < but not for the cyrillic characters. As workaround I tried to escape the characters myself and use them as bean field values. However, this will result in an escaped & plus the #1044; which I don't want.

Either I need to disable escaping (for escaping the characters myself) or I need to find a way to let Castor do the work. Does anybody have any ideas on this?

Thanks,

Ben

Re: Automatically escape cyrillic characters

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ben,

in order to be able to answer your question and/or address your problem
in an adequate manner, I'n need a small test case to be able to replay
the problem (and look at some things in particular).

Can you please add a new Jira issue at

http://jira.codehaus.org/browse/CASTOR

and attach all relevant files.

Regards
Werner

Benjamin Muschko wrote:

> Hi,
>
> I'm using Castor and want to automatically get escaped cyrillic characters
> when marshalling my bean (e.g. Д to Д). I'm using a StringWriter as
> input for the marshaller. The resulting XML includes escaped sequences for >
> and < but not for the cyrillic characters. As workaround I tried to escape
> the characters myself and use them as bean field values. However, this will
> result in &#1044; which I don't want.
>
> Either I need to disable escaping (for escaping the characters myself) or I
> need to find a way to let Castor do the work. Does anybody have any ideas on
> this?
>
> Thanks,
>
> Ben

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Automatically escape cyrillic characters

by Benjamin Muschko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Werner,

I opened a Jira issue (key: CASTOR-2429) and added my test source code: http://jira.codehaus.org/browse/CASTOR-2429

Thanks,

Ben

Werner Guttmann wrote:
Hi Ben,

in order to be able to answer your question and/or address your problem
in an adequate manner, I'n need a small test case to be able to replay
the problem (and look at some things in particular).

Can you please add a new Jira issue at

http://jira.codehaus.org/browse/CASTOR

and attach all relevant files.

Regards
Werner

Benjamin Muschko wrote:
> Hi,
>
> I'm using Castor and want to automatically get escaped cyrillic characters
> when marshalling my bean (e.g. Д to Д). I'm using a StringWriter as
> input for the marshaller. The resulting XML includes escaped sequences for >
> and < but not for the cyrillic characters. As workaround I tried to escape
> the characters myself and use them as bean field values. However, this will
> result in &#1044; which I don't want.
>
> Either I need to disable escaping (for escaping the characters myself) or I
> need to find a way to let Castor do the work. Does anybody have any ideas on
> this?
>
> Thanks,
>
> Ben

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Automatically escape cyrillic characters

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you.

Werner

Benjamin Muschko wrote:

> Werner,
>
> I opened a Jira issue (key: CASTOR-2429) and added my test source code:
> http://jira.codehaus.org/browse/CASTOR-2429
>
> Thanks,
>
> Ben
>
>
> Werner Guttmann wrote:
>> Hi Ben,
>>
>> in order to be able to answer your question and/or address your problem
>> in an adequate manner, I'n need a small test case to be able to replay
>> the problem (and look at some things in particular).
>>
>> Can you please add a new Jira issue at
>>
>> http://jira.codehaus.org/browse/CASTOR
>>
>> and attach all relevant files.
>>
>> Regards
>> Werner
>>
>> Benjamin Muschko wrote:
>>> Hi,
>>>
>>> I'm using Castor and want to automatically get escaped cyrillic
>>> characters
>>> when marshalling my bean (e.g. Д to Д). I'm using a StringWriter as
>>> input for the marshaller. The resulting XML includes escaped sequences
>>> for >
>>> and < but not for the cyrillic characters. As workaround I tried to
>>> escape
>>> the characters myself and use them as bean field values. However, this
>>> will
>>> result in &#1044; which I don't want.
>>>
>>> Either I need to disable escaping (for escaping the characters myself) or
>>> I
>>> need to find a way to let Castor do the work. Does anybody have any ideas
>>> on
>>> this?
>>>
>>> Thanks,
>>>
>>> Ben
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Automatically escape cyrillic characters

by Lee Theobald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There doesn't seem to have been any progress on this issue.  Has anyone found a work around?

I'm trying to escape a string like "£10 per hour".  As Xerces doesn't escape the pound sign, I am doing it myself before passing into Castor for marshalling.  For example, I start with a string containing "&#163;10 per hour".  But after marshalling, Castor escapes the ampersand to produce "&amp;#163;10 per hour".  The encoding the ampersand is unnecessary as far as I know "&#163;" is valid for inclusion in XML.

Example strings are formatted to look OK on a web page.  Here are unescaped versions if it helps readability in text emails etc.:
Starting with - "£10 per hour"
Escaping to - "£10 per hour"
After marshalling left with - "&#163;10 per hour"

Regards,
Lee

Re: Automatically escape cyrillic characters

by Werner Guttmann-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lee,

sorry, this cannot be dealt with through Castor. You could, though,
always come up with your own Serializer extension(s)/customization(s).

Regards
Werner

Lee Theobald wrote:

> There doesn't seem to have been any progress on this issue.  Has anyone found
> a work around?
>
> I'm trying to escape a string like "£10 per hour".  As Xerces doesn't escape
> the pound sign, I am doing it myself before passing into Castor for
> marshalling.  For example, I start with a string containing "£10 per
> hour".  But after marshalling, Castor escapes the ampersand to produce
> "&#163;10 per hour".  The encoding the ampersand is unnessiary as far as
> I know "£" is valid for inclusion in XML.
>
> Regards,
> Lee

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email