Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12024] iOS: ("backslash en") is ignored in strings.xml

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-12-12T01:42:22.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.1.0, 2012 Sprint 25, 2012 Sprint 25 JS
ComponentsiOS
Labelsmodule_label, qe-testadded, regression, triage
ReporterKonstantinos Roussos
AssigneeChris Barber
Created2012-12-10T22:39:32.000+0000
Updated2013-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

FileDateSize
app.js2012-12-12T01:06:45.000+00001555
strings.xml2012-12-12T01:33:01.000+0000209

Comments

  1. Daniel Sefton 2012-12-10

    Could you provide a little more detail? What's the input compared with the output? Also, which platform? Android and/or iOS?
  2. Konstantinos Roussos 2012-12-11

    I'm talkink about iOS. For example assume that I have this values in strings.xml:
       <string name="addLabelSimple">"Hello /n Friend"</string>
       
    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.
  3. Daniel Sefton 2012-12-11

    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.
  4. Chris Barber 2012-12-11

    @Daniel, is that acceptable printing \n as a normal string?
  5. Daniel Sefton 2012-12-11

    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.
  6. Ingo Muschenetz 2012-12-11

    I'm reviewing the old python code, and I don't think we should escape the backslashes. We didn't do so previously.
  7. Chris Barber 2012-12-12

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/3579 3.0.x pull request: https://github.com/appcelerator/titanium_mobile/pull/3580
  8. Satyam Sekhri 2013-01-18

    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

JSON Source