Baruch
Baruch

Reputation: 21516

Unicode and Android NDK

Is there any way to use UTF-8/16 strings in the NDK without including a multi-megabyte library such as ICU? Is ICU built in to Android?

Upvotes: 4

Views: 3281

Answers (4)

Nemanja Trifunovic
Nemanja Trifunovic

Reputation: 24561

If you want something smaller than ICU, check UTF8-CPP library.

Upvotes: 0

Sergey K.
Sergey K.

Reputation: 25386

std::string is capable of storing UTF-8 directly. You will need special libraries, like ICU, only if you want to parse strings in some way. For a simple output without parsing, just go with std::string and forget about all those libraries.

Upvotes: 4

Behrouz.M
Behrouz.M

Reputation: 3573

Alternative lib: Iconv

Size: about 900kb (which is smaller in APK)

Upvotes: 0

Steven R. Loomis
Steven R. Loomis

Reputation: 4350

ICU is only multimegabyte if you go with a default build including all this, hundreds of codepages and several hundred locales worth of data.

Have a look at "Making ICU Smaller". I just added a note about using static builds.

HTH

Upvotes: 3

Related Questions