【发布时间】:2011-04-26 01:04:24
【问题描述】:
我有一个大型 C/C++ 库,我需要将其用作 Android NDK 项目的一部分。该库需要能够智能处理 UTF8 字符串(例如,转换为小写/大写)。
该库具有条件编译功能,可以使用 OS API 进行转换,但似乎没有任何适用于 UTF8 的 Android API。 (mbstowcs等)
This thread 说要使用 JNI 方法来做(!),这是一个相当重量级的解决方案。
我正在考虑构建 ICU,但由于它使用 GNU Autotools,我不确定是否可以使其与 NDK 工具链一起使用。 :/
除了使用 JNI 之外,还有其他人遇到过这个问题并做过其他事情吗?
编辑:我试图让 ICU 编译在配置步骤失败:
checking wchar.h usability... no
checking wchar.h presence... yes
configure: WARNING: wchar.h: present but cannot be compiled
configure: WARNING: wchar.h: check for missing prerequisite headers?
configure: WARNING: wchar.h: see the Autoconf documentation
configure: WARNING: wchar.h: section "Present But Cannot Be Compiled"
configure: WARNING: wchar.h: proceeding with the preprocessor's result
configure: WARNING: wchar.h: in the future, the compiler will take precedence
checking for wchar.h... yes
checking for library containing wcscpy... none required
checking size of wchar_t... 0
configure: error: There is wchar.h but the size of wchar_t is 0
【问题讨论】:
-
你有没有让这个工作?
-
@tofutim 不,但我也无法重新访问它。
-
正好遇到了这个问题。
-
添加了 ICU 标签。完全错过了这个问题。
-
我在 OSX 上编译 android 的 49.1.2 再次遇到了同样的问题。 :(
标签: android unicode utf-8 android-ndk icu