Using gperf for UTF-16 encoded input?

When moving code that uses a gherf-generated hash function to use UTF-16 for its lines, how would you adapt / call the hash function? Possible options:

  • Convert UTF-16 to UTF-8 for hashing.
    This should work as it’s ready, but it includes a conversion step that I hope to avoid.
  • Use the parameter -cto use gperf strncmpand properly encode the input file by writing \000h\000e\000l\000l\000ofor hello.
    I have not actually tested this and would prefer the input file to be readable and grep-able. But I think that the transformation step could be done with preprocessing the script from the actual source file.
+3
source share

Source: https://habr.com/ru/post/1776644/


All Articles