Page 1 of 1
CSV export format: First Line ?
Posted: Sat Aug 12, 2023 3:52 am
by NotVeryProfessional
When exporting the DB to CSV, there is a line before the headers that contains the locale and some unicode character.
It appears that deleting that line doesn't lead to any import errors, but will it work? That line wouldn't be there if it's not important. Unfortunately, it does break some CSV editors I've tried.
Re: CSV export format: First Line ?
Posted: Sat Aug 12, 2023 9:21 am
by Tony Li
Hi,
Which CSV export feature are you using?
Using the Dialogue Editor's Database section > Export Database function on the Demo Database using the default checkboxes produces this CSV:
Code: Select all
Database
Name,Version,Author,Description,Emphasis1,Emphasis2,Emphasis3,Emphasis4
Demo Database,1.5.1.0,Pixel Crushers,"This project demonstrates the major features of the Dialogue System for Unity. In this sci-fi scene, the player's squad has been sent to intercept launch codes to stop the launch of a weapon against their homeworld.",#ff0000ff b--,#44b634ff b--,#4688e6ff b--,#ccccccff b--
Global User Script ...
There shouldn't be a local/unicode header. The first line should be "Database".
Re: CSV export format: First Line ?
Posted: Sat Aug 12, 2023 1:44 pm
by NotVeryProfessional
I'm using the export function underneath the Localization header.
I've added a "de" (german) Locale into the list, and when I export, my Dialogue_de.csv file starts like this:
Code: Select all
<U+FEFF>de,,,,,,,,
Conversation ID,Entry ID,Actor,Original Text,Translated Text [de],Original Menu,Translated Menu [de],Description,
1,0,Player,,,,,,
1,1,Agnes,"Good Morning! ",Guten Morgen!,,,,
Re: CSV export format: First Line ?
Posted: Sat Aug 12, 2023 3:04 pm
by Tony Li
Hi,
I think somehow you've added a
zero length no-break space character (U+FEFF) to the language name. Try removing the "de" entry from the Localization Export/Import table and re-adding it.
If that doesn't fix it, maybe you have a field in your database whose title is the zero length no-break space followed by "de".
Re: CSV export format: First Line ?
Posted: Sun Aug 13, 2023 1:37 am
by NotVeryProfessional
I've got the same thing on en (before I removed it, realizing I don't need it) and I've now double-checked by adding another locale for testing and getting the same character on it.
Also, I have this on every file. Actors_xx.csv, Quests_xx.csv, and Dialogue_xx.csv.
If I use the "export database", it looks like this:
Code: Select all
<U+FEFF>Database
Name,Version,Author,Description,Emphasis1,Emphasis2,Emphasis3,Emphasis4
I'm using Dialogue System v2.2.38.1 on MacOS, Unity 2022.3.4f1
I've now updated to Dialogue System v2.2.39 and the problem remains.
Re: CSV export format: First Line ?
Posted: Sun Aug 13, 2023 1:41 am
by NotVeryProfessional
Looking into the code, it really makes no sense that this special character is there:
Code: Select all
file.WriteLine("Database");
file.WriteLine("Name,Version,Author,Description,Emphasis1,Emphasis2,Emphasis3,Emphasis4");
But anyways, that wasn't the issue. The question was: Would anything break if I remove that starting line? Some CSV editors expect the first line to be the headers and break in various ways if it isn't.
Re: CSV export format: First Line ?
Posted: Sun Aug 13, 2023 10:24 am
by Tony Li
The code you excerpted is from the Export Database section's database-to-CSV export, not the Localization Export/Import section. With the Localization Export/Import that you're using, you can leave the top line blank or add commas (i.e., replace "<U+FEFF>Database" with ",,,,,,,") but you can't remove the line entirely. That should shift up the entire table by 1 row.
Re: CSV export format: First Line ?
Posted: Sun Aug 13, 2023 4:18 pm
by NotVeryProfessional
Yes, I know. Couldn't find the other code line quickly and am still wondering where that Unicode is coming from. Anyway.
With a bit of converting magic, it works for me now. Thanks for the quick answers - as always, amazing support.
Re: CSV export format: First Line ?
Posted: Sun Aug 13, 2023 5:09 pm
by Tony Li
Glad to help!