2

假设librdf_uri_as_string ()使用 UTF-8 编码返回的字符串是否安全。或者它可能是ISO-Latin(带有额外的 URL 编码)?

我正在librdf_model处理librdf_parser_parse_file_handle_into_model ()FILE *. 如果我切换到一个raptor_parser(或许raptor_iostream也不是FILE *)会有帮助吗?Raptor文档特别提到了 UTF-8 。

只是librdf_parser一个包装器raptor_parser,因此答案是 UTF-8?

4

1 回答 1

2

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.

于 2014-01-09T20:26:22.420 回答