Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
Ruby - WebDialog.set_html() and string with null character
-
When the string containing null character is passed to WebDialog.set_html() the page is loaded up to this characted.
Here is the test case:
NASTY_STRING = "asd\000dsa" UI.menu("Plugins").add_item("test set_html") do dlg = UI;;WebDialog.new("test set_html", true); dlg.set_html(NASTY_STRING) dlg.show() # only "asd" is displayed end UI.menu("Plugins").add_item("test set_file") do dlg = UI;;WebDialog.new("test set_file", true); temp_file = ENV['TEMP'] + "\\test_set_file.html" File.open(temp_file, "wb") do |file| file.write(NASTY_STRING) end dlg.set_file(temp_file) # only "asddsa" is displayed dlg.show() endI understand this is pretty nasty edge case, but still can produce mind boggling results/surprises.
-
NULL characters aren't allowed in HTML. And NULL characters are in C (I think) used to terminate a string.
Advertisement