c - ArgumentError: string contains null byte when use StringValueCStr -
here test file
here full code (github.com/roroco/ro_article/tree/string-contains-null-byte)
i "argumenterror: string contains null byte" when run following code:
in ruby side:
get_article(file.read("test_file"))
in c side:
value get_article(value self, value html) { str html2 = stringvaluecstr(html);
the test file large, how find null byte in file? , how make stringvaluecstr work string contains "null byte"
when use following code:
body = file.read("test_file") result = body.inspect
i have "result" contains "\u0000"(my encoding utf8), solution is
body.gsub(%r{\u0000}, "")
do in ruby side or c side
Comments
Post a Comment