I notice that #2 fixes cases with a ' in, however I have seen this fail since and cURL has the ability to read form parameters directly from a file so why not let it handle it?
man curl
To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.
I notice that #2 fixes cases with a
'
in, however I have seen this fail since and cURL has the ability to read form parameters directly from a file so why not let it handle it?