[Resolved]\n (line jump) not working when i read strings from .plist and .xml files


#1

Hi guys.
Im having a problem with the line jump when i read from a .plist file.

So if i create a label directly with the text like next, the works.
CCLabelTTF* pLabel = CCLabelTTF::create("Hi\nThis works", "tahoma.ttf", 36 , CCSizeMake(visibleSize.width-50, 0),kCCTextAlignmentLeft);

Howeber, if i read exactly same string from a .plist file and i create the label with this one then the “” appears on the label instead of replacing them with line jumps.
CCDictionary* dict = CCDictionary::createWithContentsOfFile("preguntas.plist"); CCString question = ((CCString)*dict->valueForKey("1")); CCLabelTTF* pLabel = CCLabelTTF::create(question.getCString(), "tahoma.ttf", 36 , CCSizeMake(visibleSize.width-50, 0),kCCTextAlignmentLeft);

The content of the .plist file is
`<?xml version="1.0" encoding="UTF-8"?>

1 Hi\nThis works `

It seems some kind of format conversion between CCstrings, strings and characters, but i havn’t figured how to solve it. ¿Anyone knows whats happening here?

Thanks for your help.


#2

I’ve tryed with .xml and it’s failing too.

At some point the char “” is being splited into the two chars “ and”n" and then the label is unable to understand the line jump and just print both chars. Don’t know how to fix that.


#3

Okey, its solved. Just in case someone else have this problem.

isn’t need in .xml, just use linejumps as usual!

So, instead of writte in .xml like this:
Hi\nThis works

Do it this way:
Hi
This works

You can close this thread sorry !