From 92f5984d2c2cd73b6b9f68c02c147877d1e2fc46 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 4 Dec 2009 09:38:48 -0800 Subject: Optional use of UTF-8 strings in resource bundles Allows the use of UTF-8 for packing resources instead of the default of UTF-16 for Java. When strings are extracted from the ResStringPool, they are converted to UTF-16 and the result is cached for subsequent calls. When using aapt to package, add in the "-8" switch to pack the resources using UTF-8. This will result in the value, key, and type strings as well as the compiled XML string values taking significantly less space in the final application package in most scenarios. Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a --- include/utils/String8.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/utils/String8.h') diff --git a/include/utils/String8.h b/include/utils/String8.h index ecc5774379..c4b18a4caa 100644 --- a/include/utils/String8.h +++ b/include/utils/String8.h @@ -57,6 +57,11 @@ size_t utf8_length(const char *src); */ size_t utf32_length(const char *src, size_t src_len); +/* + * Returns the UTF-8 length of "src". + */ +size_t utf8_length_from_utf16(const char16_t *src, size_t src_len); + /* * Returns the UTF-8 length of "src". */ @@ -120,6 +125,9 @@ size_t utf8_to_utf32(const char* src, size_t src_len, size_t utf32_to_utf8(const char32_t* src, size_t src_len, char* dst, size_t dst_len); +size_t utf16_to_utf8(const char16_t* src, size_t src_len, + char* dst, size_t dst_len); + } // --------------------------------------------------------------------------- -- cgit v1.2.3-59-g8ed1b