Encoding problem with cyrillic letters in a gdx-file

questions about GAMS' tools
Post Reply
akos
User
User
Posts: 5
Joined: 4 years ago
Location: Russia

Encoding problem with cyrillic letters in a gdx-file

Post by akos »

Dear all,

I use cyrillic letters for explanatory texts in my GAMS code. Then I try to export input data and my solution to a gdx file using the command execute_unload, I see that all explanatory strings in the resulting gdx-file are displayed as a gibberish. Is there any way to fix such encoding problem or only latin symbols are allowed in the GAMS gdx facility?
Freddy
User
User
Posts: 16
Joined: 5 years ago

Re: Encoding problem with cyrillic letters in a gdx-file

Post by Freddy »

akos,
How are you viewing your gdx file? Gdx does not know anything about encoding. This means it stores explanatory text with the same enconding as the .gms file with your „execute_unload“ command. GAMS Studio provides a way to reload the current file with a different encoding via „Edit“->“Reload with...“. We recommend using UTF-8 as the enconding of your gms/include files.
It is absolutely no problem to use non-ASCII characters in the explanatory text!
akos
User
User
Posts: 5
Joined: 4 years ago
Location: Russia

Re: Encoding problem with cyrillic letters in a gdx-file

Post by akos »

Thank you, Freddy

The encoding problem appears in the gdxviewer. I have tried GAMS Studio to view the generated gdx and have not noticed any problem there: all russian text is displayed correctly.

But my actual problem and the reason why I asked for a help here is that I use this intermediate gdx file to create an xlsx file with a full solution via the gdx2xls utility. And the encoding problem appears on the first sheet of the xlsx file: table of content. More interesting is that explanatory russian texts are displayed correctly on the remaining sheets of the xlsx file. Only TOC page seems to be affected by the problem.

I have tried the "Reload with" command as you suggested with UTF-8 and KOI8-R. It did not help: russian symbols in gams code turned to gibberish and gibberish in gdx and xlsx files turns to other gibberish.
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Encoding problem with cyrillic letters in a gdx-file

Post by bussieck »

I guess there is currently no other way than to create (utf-8 encoded) CSV file (from GAMS) and to load these into Excel. We (GAMS) has this on the radar and are working on this.

-Michael
Post Reply