librdf 如果从 Raptor 提升一个抽象级别。基本上,librdf 是一个应用程序级库,它将 Raptor、Rasqal 和 RDF 存储包装在一起。如果您在 librdf 级别上工作,则基本上应该只使用 librdf API,尽管这里和那里有一些泄漏的抽象。
通常在 API 中,当您看到作为 传入的字符串时(const) unsigned char *
,它一直是 UTF-8。只有一些标识符(例如语法名称)作为(const) char *
ASCII 格式传递。
披露/警告:我是 Redland 项目的提交者,但近年来一直没有积极参与这些项目。我以前很了解内部结构,但我的记忆力并不完美。
要回答具体问题:
假设librdf_uri_as_string ()
使用 UTF-8 编码返回的字符串是否安全。
是的。
Would it help if I switch to a raptor_parser
(and perhaps raptor_iostream
instead of FILE *
as well)?
No, there's practically no difference. Just negligible amount of less wrapper code and a slightly different API.
Is librdf_parser
just a wrapper for raptor_parser
and the answer is UTF-8 because of that?
Yes.