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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -