xpressive - delete weird character is a string
Hello, I have strings coming from a webpage (through a post form and fastcgi application) that contain "weird characters". In vim, those characters appears like ^@ in blue. Those weird characters were not there in the web form but are there in my fasctcgi application. I suspect they appear like that because of issues with charset but I am not sure. I would like to have a function to remove those weird characters from the strings and I would think that xpressive would be a good tool for that. When the weird characters are at the ends of the string, I trim using this function and the boost algo library void remove_non_graph(std::string& str) { using namespace boost; trim_if(str, !is_print()); return; } but this does not work when the weird character is inside the string or there are break lines. Is there an easy way to clean those strings with xpressive? Thank you Jean
On Thu, Dec 23, 2010 at 12:09:24PM -0800, Jean-Christophe Roux wrote:
Hello,
I have strings coming from a webpage (through a post form and fastcgi application) that contain "weird characters". In vim, those characters appears like ^@ in blue. Those weird characters were not there in the web form but are there in my fasctcgi application.
In vim, in NORMAL mode you can move the cursor over the character and use the command ga to query the character under the cursor. Here, I get: <^@> 0, Hex 00, Octal 000 , which says that it's a nul terminator. You might have missed some part of the multipart POST spec, or some translation that FastCGI does for you. -- Lars Viklund | zao@acc.umu.se
participants (2)
-
Jean-Christophe Roux
-
Lars Viklund