开发者

Using gperf on UTF-16 encoded input?

When moving code that uses a gperf-generated hashing function to use UTF-16 for its strings, how would you adapt/call the hashing function? The options I can see are:

  • Convert UTF-16 to UTF-8 for the hashing.

    This should work out-of-the-box, but involves a conversion step I hope to be able to avoid.

  • Use the -c开发者_如何学编程 option to make gperf use strncmp and encode the input file accordingly, writing \000h\000e\000l\000l\000o for hello.

    I didn't actually test this and would prefer to keep the input file readable and grep-able. But I guess the transformation step could be done with a preprocessing script from the actual source file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜