Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accented characters from spreadsheet file don't display correctly #16

Open
4er4er4er opened this issue Jan 3, 2021 · 2 comments
Open

Comments

@4er4er4er
Copy link

A user wants to read a set from this sheet, in an xlsx file (also attached) created by Excel:

image

The amplxl driver is used like this:

set FAMILY;
table FAMILY "amplxl" "FAMILY.xlsx": [FAMILY] IN;
read table FAMILY;
display FAMILY;

But under Windows, the set displays like this in a command window,

image

and like this in the IDE:

image

The problem is that Excel uses UTF-8 encoding, while the command window and the IDE are displaying the set member names using different extended ASCII encodings. AMPL stores the correct UTF-8 bytes, so that results written out to a spreadsheet do show the correct accented characters.

It's not clear what to recommend to the user, other than to avoid accented (and other non-ASCII) characters in the spreadsheet, but I'm opening this issue in case anyone has an idea.

@nfbvs
Copy link
Contributor

nfbvs commented Jan 5, 2021

Still looking at this. It works as expected in Linux. The xml library is supposed to handle the utf-8 conversion without intervention from the programmer. We probably need some specific configuration for MSVS.

@fdabrandao
Copy link
Member

In the terminal, the user can change the terminal encoding by running chcp 65001 before starting AMPL (https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8). By default the terminal seems to be working with UTF-16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants