# Generating CReturn in xml file

**URL:** <https://www.ruby-forum.com/t/generating-creturn-in-xml-file/105721>\
**Category:** Ruby\
**Created:** [June 1, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/generating-creturn-in-xml-file/105721 "2007-06-01T19:35:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josselin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Post date:** [June 1, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/generating-creturn-in-xml-file/105721/1 "2007-06-01T19:35:45Z")

</div>

I am generating an xml output file from my rails app to be read in  
Flash… working fine as long as I don’t have to insert a CR in a string  
to be understood by Flash

Flash can understand the CR if the character is embedded (ASCII  
code for CR)

so if I have a string like “Announce 14 at 04/04/2007”, it will  
display correctly into my Flash object as

Announce 13  
at 04/04/2007

my problem is how to generate the string, I tried :

name\_label = “Announce " + proposition.id.to\_s + “\nat " +  
post.created\_at.utc.strftime(”%d/%b/%Y”)  
but it’s not working  
I also tried …  
name\_label = “Announce " + proposition.id.to\_s + " at " +  
post.created\_at.utc.strftime(”%d/%b/%Y")  
not working  
… how can I put this character sequence as it ?

thanks for your help

joss

---

<div class="post-metadata">

**Author:** ![Josselin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Post date:** [June 2, 2007, 8:05am UTC](https://www.ruby-forum.com/t/generating-creturn-in-xml-file/105721/2 "2007-06-02T08:05:57Z")

</div>

On 2007-06-01 20:51:13 +0200, Brian C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) said:

> > my problem is how to generate the string, I tried :  
> > “\r” is character 13. “\n” is character 10.
> 
> $ irb1.8  
> irb(main):001:0\> “\r”[0]  
> =\> 13

thanks Brian… I was mixin chracter sets… \r is the right one  
… it runs very well…  
my Flash app is very happy to get it…

joss

---

<div class="post-metadata">

**Author:** ![Josselin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Post date:** [June 1, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/generating-creturn-in-xml-file/105721/3 "2007-06-01T20:51:55Z")

</div>

On Sat, Jun 02, 2007 at 02:35:15AM +0900, Josselin wrote:

> name\_label = “Announce " + proposition.id.to\_s + “\nat " +  
> post.created\_at.utc.strftime(”%d/%b/%Y”)  
> but it’s not working  
> I also tried …  
> name\_label = “Announce " + proposition.id.to\_s + " at " +  
> post.created\_at.utc.strftime(”%d/%b/%Y")  
> not working  
> … how can I put this character sequence as it ?

“\r” is character 13. “\n” is character 10.

$ irb1.8  
irb(main):001:0\> “\r”[0]  
=\> 13
