You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jan Behrens <ja...@daxcolog.de> on 2004/07/24 19:19:46 UTC

application resources and escape characters

Hi list,

I extract language specific messages from the struts application resources
within my applications logic to generate the subject and body of auto
generated emails. I used to do this via string constants but switched over
to using the resources. Everything works fine except the line breaks I would
like to have in the text. I generate only plain text emails and used to have
something like the following to insert line breaks whenever I needed them:

String body = "This is a test \n\n new line below...";

Resulting in the following email body: 

<mail body>
This is a test

new line below...
</mail body>

That worked fine as long as I used the String constants (as in the example
above) but ceased to do so after switching to the
org.apache.struts.util.PropertyMessageResources variant. My application
resources contain the same string as before but the email message then looks
like this:

<mail body>
This is a test \n\n new line below...
</mail body>

Any ideas how this can happen, or possibly a solution? I can not fall back
to sending html mails unfortunately...

TIA, Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: application resources and escape characters

Posted by Jan Behrens <ja...@daxcolog.de>.
In response to my own post:

I apologize for being stupid. I did not realize that the properties editor
of my IDE (netbeans) automatically converted escape characters as well as
other special characters... So every \n I typed became a \\n :( No wonder it
didn't work. 

Cheers, Jan



> -----Original Message-----
> From: Jan Behrens [mailto:jan.behrens@daxcolog.de] 
> Sent: Saturday, July 24, 2004 7:20 PM
> To: 'Struts Users Mailing List'
> Subject: application resources and escape characters
> 
> 
> Hi list,
> 
> I extract language specific messages from the struts 
> application resources
> within my applications logic to generate the subject and body of auto
> generated emails. I used to do this via string constants but 
> switched over
> to using the resources. Everything works fine except the line 
> breaks I would
> like to have in the text. I generate only plain text emails 
> and used to have
> something like the following to insert line breaks whenever I 
> needed them:
> 
> String body = "This is a test \n\n new line below...";
> 
> Resulting in the following email body: 
> 
> <mail body>
> This is a test
> 
> new line below...
> </mail body>
> 
> That worked fine as long as I used the String constants (as 
> in the example
> above) but ceased to do so after switching to the
> org.apache.struts.util.PropertyMessageResources variant. My 
> application
> resources contain the same string as before but the email 
> message then looks
> like this:
> 
> <mail body>
> This is a test \n\n new line below...
> </mail body>
> 
> Any ideas how this can happen, or possibly a solution? I can 
> not fall back
> to sending html mails unfortunately...
> 
> TIA, Jan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org