• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows [SOLVED] Problem with importing .csv files

Rob

Member
Ever since I've been importing .csv files using the load_csv function, I've had a particular problem and I don't understand what's causing it.

When I try to read the data from cell 0, 0 there is always some kind of issue. If it's a number, gamemaker gives me an error saying that it cannot convert the number into a real.

If it's a string, the string that gamemaker puts out is slightly different than what's in the .csv (from memory it was some kind of rectangular character?)

I know I can use string_digits (which was the fix I used for converting the string into a number) but I just wondered if I was missing something.
 

TsukaYuriko

🌠
Forum Staff
Moderator
How is the text file encoded? If it's only cell 0,0, I'm suspecting that's a byte order mark messing up your import. Make sure it's encoded as UTF-8 (without BOM).
 

Rob

Member
How is the text file encoded? If it's only cell 0,0, I'm suspecting that's a byte order mark messing up your import. Make sure it's encoded as UTF-8 (without BOM).
At the moment I make an excel sheet, fill it out, and then File > Save As > and then choose this highlighted option "CSV UTF-8 (Comma delimited) (*.csv)". I couldn't find out what BOM was, sorry :(

Screenshot 2020-02-13 20.06.10.png
 

TsukaYuriko

🌠
Forum Staff
Moderator
BOM means byte order mark. It's a series of characters at the start of a file to indicate some aspects about its encoding - in the case of UTF-8, that's "" (which may be drawn as squares if your font does not support these characters). The fact that your issue only happens with the top-leftmost cell, so the one at the start of the file, leads me to suspect that the file may have a BOM that is being read as a part of that cell, leading to the problem you described.

Open the generated file in Notepad++. Under Encoding, make sure that the "Encode in UTF-8" (as opposed to UTF-8 BOM) option is checked. If not, convert it to UTF-8.
 

gnysek

Member
I think that in latest Windows 10 builds (1903+) even normal Notepad allows to save in UTF-8 without BOM (by default!).
 
Top