Hi,
[lua]
textStr = string.gsub( textStr, “%p”, “”)
[/lua]
should strip our punctation from “textStr”.
On iOS this works as intended, on Android all German umlauts “äöüÄÖÜß” are stripped out, too.
And I think this can happen for special characters in french, spanish etc., too.
To reproduce this get hold of the “Hello World” sample, adapt it as shown below and compile it for iOS and for Android and test the app/apk on the device.
On iOS this works as intended, on Android all German umlauts “äöüÄÖÜß” are stripped out.
I entered this into the bug database as [bug 22849].
Best,
Andreas
P.S.:
As a quick fix strip the punctuation you don’t want out by hand, e.g. like this:
[lua]
textStr = string.gsub( textStr, ‘[%?%.%-,;:»«"]’, “”)
[/lua]
P.P.S.:
Adapted Hello-World sample:
[lua]
– Abstract: Hello World sample app, using native iOS font
– To build for Android, choose an available font, or use native.systemFont
–
– Version: 1.2
–
– Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license
– Copyright © 2010 Corona Labs Inc. All Rights Reserved.
local background = display.newImage( “world.jpg” )
local textStr = “Schönes Wetter!” – “nice weather!”
– show text without transformation
local myText = display.newText( textStr, 0, 0, native.systemFont, 30 )
myText.x = display.contentWidth / 2
myText.y = display.contentWidth / 4
myText:setTextColor( 255,110,110 )
– transform text
– should strip-out punctation, like “!”
textStr = string.gsub( textStr, “%p”, “”)
– show text with transformation
local myText = display.newText( textStr, 0, 0, native.systemFont, 30 )
myText.x = display.contentWidth / 2
myText.y = display.contentWidth / 2
myText:setTextColor( 255,110,110 )
– iOS & simulator: works fine, just strips out the “!”
– result: “Schönes Wetter”
– Android: bug, strips out “!” and the umlaut “ö” ( and all other German umlauts like “üäÖÜÄß” )
– result: “Schnes Wetter”
[/lua]