generating CReturn in xml file

J

Josselin

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
 
B

Brian Candler

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 ?

"\r" is character 13. "\n" is character 10.

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

Josselin

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 ?

"\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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,053
Members
47,656
Latest member
rickwatson

Latest Threads

Top