[GIS] Is it possible to use non-printable characters as delimiter for text file layer in QGIS

asciicsvdelimiterqgis

I am trying to import a Delimited Text File Layer from a .csv file in QGIS. Because this caused a lot of errors, I posted a question here and got the hint towards using ASCII non-printable control characters as delimiters. These are described on Wikipedia and in this blog post.

Since I am using Tweets, for which it is very difficult to find a convenient delimiter because nearly all characters are used in them, I really want to give this a shot. However, I cannot find out how to import a text file into QGIS specifying these characters as delimiters. I tried the different spellings that are given in Wikipedia as custom characters and as regular expression.

0x31
0x1F
^_

None of these work. Interestingly, the lines are detected correctly – only the record delimiters are a problem.

Any ideas?

Best Answer

Have you thought about using a combination delimiter? For instance, if you know $, ^, and # may be used in your string, make the delimiter #&^. I am not sure if QGIS supports multiple character delimiters directly. You can always call python's split("#&^") in order to manually split the string and handle individual values that way.

We ran into that issue and ended up using ¬ as a delimiter because we knew that would never be collected in a shapefile. We keep the same standing encoding but used an alt-key character.