Curly quotes in a label - how do you use them?
var label = Ti.UI.createLabel({
text: 'Curly quotes like this’ how do i use them',
color: '#ff99ff',
textAlign:'left',
top:25,
left:165,
width: 150,
height:'auto',
font:{fontWeight:'bold',fontSize:12}
});
Generates the following error
Error Domain=NSCocoaErrorDomain Code=261 UserInfo=0x503b970 "Operation could not be completed. (Cocoa error 261.)"
I have an array of strings that may contain many characters that will throw errors. what's the best way to escape them?
I've tried escape() and then unescaping them. Any help much appreciated.
7 Answers
-
Ok I've figured it out, by default the editor I'm using (Coda), is creating documents with the encoding set as Western(Mac OS Roman). Changing it to unicode fixed the issue.
Thanks for all the help.
-
Just tossed in an array of upper ASCII characters including curly quotes with no special coding. All worked fine.
Your example text worked as well.
What specific characters cause problems.
-
What is your sdk version?
I tested your exemple and dont have any problem.
-
This worked for me…
text:'La Grande \'Goule Wooden Dragon Carried in Religious Processions',
-
i'm compiling it for 3.1
Eldon - I know how to escape a single quote. I do it for other strings in the array but the same method just doesn't work for curly ones. Is this a known bug?
-
Try put a backslash '' before the character.
-
After some testing it appears it's only the smart quotes - either double “ or single ’ that are causing the problems.
Escaping them with a backslash doesn't help.