encoding01.gms : Test processing of source files with BOM

Description

This test checks the handling of source files starting with a BOM.

UTF8 BOM should be handled well.
UTF16BE, UTF16LE, UTF32BE, and UTF32LE should fail with an explicit error.
Other BOMs should result in an unspecfic error

Contributor: Lutz Westermann, December 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : encoding01.gms

$title Test processing of source files with BOM (ENCODING01,SEQ=885)

$onText
This test checks the handling of source files starting with a BOM.

UTF8 BOM should be handled well.
UTF16BE, UTF16LE, UTF32BE, and UTF32LE should fail with an explicit error.
Other BOMs should result in an unspecfic error

Contributor: Lutz Westermann, December 2021
$offText

$include bomUTF8.gms
$ifE errorlevel<>0 $abort Problem handling UTF8 BOM
$include bomUTF16BE.gms
$ifE errorFree $abort Problem expected handling UTF18 BOM
$clearError

* Try to include a csv file with UTF8 BOM
Set i / i1*i3 /;
Parameter p(i) /
$onDelim
$include pUTF8.csv
$offDelim
/;

* Try to run csv2gdx on a csv file with UTF8 BOM; if the BOM is not recognized, that would result in a domain violation
$call.checkErrorLevel csv2gdx pUTF8.csv id=p2 index=1 value=2 useHeader=n colCount=2 trace=0
Parameter p2(i);
$offFiltered
$gdxLoad pUTF8.gdx p2