Link to home
Start Free TrialLog in
Avatar of thready
thready

asked on

escaping values in import/export setting

Hi Experts,
I am writing out a tab delimited file of records (1 record per line).  My data sometimes contains tabs and CRLF pairs.  How do I escape these items correctly and how do I unescape them?

Thanks for your help!
Mike
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

It would depend on what's in the rest of the content of any field. If each is composed of simple ASCII characters in the range 0 to 0x7F, then you can search for 0x09, 0x0A or 0x0D and OR that character with 0x80 to set the high bit. Then when you read them back in, AND with 0x7F to mask out the high bits.

If your fields can contain anything in the range 0 - 0xFF, then a different strategy will be required.

Jim
Avatar of thready
thready

ASKER

Hi Jim,

I do have accents on certain characters as well...  Like èéêèà      ç

I'm starting to think I should allow multiple lines and have markers for begin and end of each record.  Just one character to delimit records, namely the | (bitwise or) character.  So for each field, I escape all backslashes by doubling them all and then I replace any instances of | with a \|

Do you think this is complete?

Mike
Avatar of thready

ASKER

Oh - what do I use as begin and end record markers?
ASKER CERTIFIED SOLUTION
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial