Lazarus

Programming => General => Topic started by: peardox on October 01, 2020, 04:58:12 pm

Title: C-Style escaped stings
Post by: peardox on October 01, 2020, 04:58:12 pm
Yes, I've looked extensively through the docs but for the life of me can't find something that'll properly escape strings.

This is something I usually want to do for quick export for further processing, e.g. export a CSV of a load of data I'll later transfer to a server and load into a DB via PHP

I want to be able to properly handle data that may already be escaped (or not) so, as a simple example...

"hello word" => \"hello world\"

Unicode is also a concern so \uXXXX is handled properly

I've come across some very naughty data that is as bad as a log with embedded escaped sequences (this can be a nightmare)

Title: Re: C-Style escaped stings
Post by: jamie on October 01, 2020, 05:25:17 pm
Look at the fpjson unit.
It has a jsontostring that handles esc
TinyPortal © 2005-2018