I have a Swedish word Pågår
in my string XML file. When I try to read this word form the string resources it only shows P g r
with å
character missing in the output. Why is this happening and how can I solve this? Please help me in solving this error.
Asked
Active
Viewed 1,018 times
0

iknow
- 8,358
- 12
- 41
- 68

AndroidDev
- 4,521
- 24
- 78
- 126
-
Not really sure, but you may have to install the supporting font, if there's any.. – Ghost Mar 06 '12 at 12:51
2 Answers
0
in eclipse try to change the xml encoding: - Window->Preferences->XML->XML Files->Encoding
EDIT: And make sure that the font you are using support this character. (just remembered this one - Translate my app to Hungarian )
-
yeh i have used custom font and when i dont use it it show all the text..so is there any way to solve this out becoz problem is shown only in swedish language and for all other languages it my custom fonts works fine..so i cant remove this fonts – AndroidDev Mar 06 '12 at 13:19
-
well, try to find some extended version of the font you use. There are also some discussions of the topic is there a way to add characters to existing font - http://superuser.com/questions/369005/is-there-a-way-to-add-reassign-characters-in-an-existing-font . I'm not really familiar with this stuff, just trying to give you some hint... – mihail Mar 06 '12 at 13:25
0
You can (should) escape special letters with the utf-8 representation for it.
Both \u00e5
and å
would work for "å" in Android.
As requested, an example of localized fonts according to link.
To use localized Fonts, you can put the special fonts in assets and name it something like "se-font.ttf
"
In your strings.xml for the Swedish language you add a value:
<string name="fontprefix">se-</string>
Then, in your app, when you load the font, you create the asset filename like so:
String fontasset = getString(R.string.fontprefix, "") + "font.ttf";
Then you should be able to load your font using the fontasset
filename
-
I have tried to use both å and \u00e5 but the it doesn't show anyhting – AndroidDev Mar 06 '12 at 13:14
-
-
@Anshuman If you are using a custom font, it seems likely that that is the problem. Make sure that your font includes all the characters you are going to use. – Jave Mar 06 '12 at 13:17
-
yeh its becoz of that only i check it..but my fonts works for other languages only it doesnt works for swedish language is there any way by which i can solve this problem so that other language should keep using my custom fonts as it is.. – AndroidDev Mar 06 '12 at 13:21
-
You'll have to either modify the font to include the missing characters, or use another font for the unsupported language/s. – Jave Mar 06 '12 at 13:23
-
how can i do that..how can i specify two different font for different language – AndroidDev Mar 06 '12 at 13:25
-
http://developer.android.com/guide/topics/resources/localization.html#using-framework – Jave Mar 06 '12 at 13:28
-
But my fonts are not in under res ..its inside assets folder..so how i put different font depending upon language – AndroidDev Mar 06 '12 at 13:32
-
Ah, take a look here then: http://stackoverflow.com/questions/5427933/localization-of-assets-files It's a question about localization of asset files. – Jave Mar 06 '12 at 13:37
-
sorry to say but i dont get it how to do that..can u show me with an simle example.. – AndroidDev Mar 06 '12 at 13:45