问题标签 [libunistring]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
203 浏览

c++ - 如何从 unicode 字符串中获取单个字符并比较、打印它们?

我正在使用libunistring处理 C 中的 unicode 字符串。无法使用其他库。我的目标是从 unicode 字符串的索引位置读取单个字符,打印它,并将其与固定值进行比较。这应该很简单,但是...

这是我的尝试(完整的 C 程序):

为了运行这个程序:

  1. 将程序保存到名为ustridx.c的 UTF-8 编码文件
  2. sudo apt-get install libunistring-dev
  3. gcc -o ustridx.o -W -Wall -O -c ustridx.c ; gcc -o ustridx -lunistring ustridx.o
  4. 确保终端设置为 UTF-8 语言环境 ( locale)
  5. 运行它./ustridx

输出:

期望的行为是正确识别char 5last char,并在输出的最后两行正确打印。

0 投票
1 回答
22 浏览

python - 如何使用 ctypes 从使用 apt install 安装的库中调用 C 函数?

我正在尝试使用模块ulc_width_linebreaksunilbrk我的 Python 字符串上的GNUlibunistring(一个 C 函数)调用。在 Ubuntu上可用,我已经安装了. 我打开了一个新的终端窗口并尝试从 Python 导入库。我尝试了以下但全部返回:ctypeslibunistringsudo apt install libunistring2 libunistring-devNone