[TIMOB-12024] iOS: ("backslash en") is ignored in strings.xml
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-12-12T01:42:22.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.1.0, 2012 Sprint 25, 2012 Sprint 25 JS |
Components | iOS |
Labels | module_label, qe-testadded, regression, triage |
Reporter | Konstantinos Roussos |
Assignee | Chris Barber |
Created | 2012-12-10T22:39:32.000+0000 |
Updated | 2013-10-08T06:24:59.000+0000 |
Description
*Problem description*
In strings.xml if there is a value with \n ("backslash") is ignored. In 2.1.4. it works fine.
*strings.xml*
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Appcelerator\nTitanium</string>
</resources>
*app.js*
var win = Ti.UI.createWindow();
var label = Titanium.UI.createLabel({
text : L("welcome_message"),
height : 'auto',
width : 'auto',
color : '#900',
font : {
fontSize : 48
},
textAlign : 'center'
});
win.add(label);
win.open();
Attachments
File | Date | Size |
---|---|---|
app.js | 2012-12-12T01:06:45.000+0000 | 1555 |
strings.xml | 2012-12-12T01:33:01.000+0000 | 209 |
Could you provide a little more detail? What's the input compared with the output? Also, which platform? Android and/or iOS?
I'm talkink about iOS. For example assume that I have this values in strings.xml:
If I try to print it in a Label, with: text:L("addLabelSimple"), in 2.1.4 I'l get correctly two lines. The first with the word "Hello" and the second with the word "Friend" But in 3.0.0 RC2, I get only this: "Hello /n Friend". So the backslash en is ignored as a special character and it is printed as a normal character sequence.
Thanks. Tested and confirmed on iOS 6 - in 2.1.4 GA it works fine, in 3.0 GA the \n is printed as a normal string.
@Daniel, is that acceptable printing \n as a normal string?
Natively the special characters are taken into account: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html#//apple_ref/doc/uid/10000051i-CH6-SW13 And it's a regression, so it would break existing apps which use those characters. But it's up to you if you think it's worth fixing over other issues I guess.
I'm reviewing the old python code, and I don't think we should escape the backslashes. We didn't do so previously.
Master pull request: https://github.com/appcelerator/titanium_mobile/pull/3579 3.0.x pull request: https://github.com/appcelerator/titanium_mobile/pull/3580
Special Character \n is not ignored. Verified on: Studio: 3.0.1.201212181159 SDK: 3.0.0.GA, 3.0.1.v20130108154840, 3.1.0.v20130114171802 iOS Device: iPhone5 (v6.0) XCode: 4.5.2 CLI: 3.0.22