Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Unicode characters in strings.xml

I have the following unicode character that I want to use in a string: 🚕

I have found its hex and decimal code through this:

While I know how to use the "&" symbol in a string in strings.xml by doing this:

    <string name="Example">Example character &amp;</string> 

I cannot use the car symbol.

How can I use this unicode character in a string in strings.xml?

Update One:

Following the first solution of using this: &#128663; I got the following error:ERROR IN APPLICATION: input is not valid Modified UTF-8:

like image 435
Roymunson Avatar asked Apr 16 '16 16:04

Roymunson


People also ask

How do I use Unicode characters in XML?

Characters are denoted using the notation used in the Unicode Standard, that is, an optional U+ followed by their hexadecimal number, using at least 4 digits, such as "U+1234" or "U+10FFFD". In XML or HTML this could be expressed as "&#x1234;" or "&#x10FFFD;".

Can XML contain Unicode?

Actually there are some elements in XML which have unicode characters along with the data. It is not clear which characters you do consider as Unicode characters and which you don't. XML/XQuery only works with Unicode characters so everything in your string is an Unicode character.

Does string support Unicode?

@MSalters: std::string can hold 100% of all Unicode characters, even if CHAR_BIT is 8. It depends on the encoding of std::string, which may be UTF-8 on the system level (like almost everywhere except for windows) or on your application level.

What is \\ u0026?

Unicode Character 'AMPERSAND' (U+0026)


2 Answers

It's

<string name="Example">Example character \u0026</string> 

See more unicode characters here:

http://www.utf8-chartable.de/unicode-utf8-table.pl?number=1024&utf8=0x

like image 191
Pwnstar Avatar answered Sep 23 '22 09:09

Pwnstar


if you go Unicode site : https://unicode-table.com/en/#control-character and click at this Unicode that says U+00AE you mustn't write the + symbol if you want copy paste this example at strings.xml :) :) :)

<string name="example">"\u00AE"</string> 
like image 20
Nikos T Avatar answered Sep 23 '22 09:09

Nikos T