gdxencoding1.gms : 간단한 gdxencoding 테스트

설명

이 테스트는 간단한 예에서 gdxencoding 기능을 테스트합니다.

기고자: Michael Bussieck, 2022년 12월

소형 모델 유형 :슬롯 무료체험


카테고리 : 슬롯 무료체험 테스트 라이브러리


메인 파일 : gdxencoding1.gms

$title 간단한 gdxencoding 테스트 (GDXENCODING1,SEQ=922)

$onText
이 테스트는 간단한 예에서 gdxencoding 기능을 테스트합니다.

기고자: Michael Bussieck, 2022년 12월
$offText

* UTF-8 인코딩
c "코트디부아르-3" / "코트디부아르-3" , "코트디부아르-3" /;
스칼라 numConv /0/;

$gdxOut c.gdx
$unLoad c
$gdx아웃
$gdxOut corg.gdx
$unLoad c
$gdx아웃

$onMulti
$callTool.checkErrorLevel gdxservice.gdxEncoding c.gdx -encodingIn=utf_8 -encodingOut=latin_1 -numConv=numConv -trace=1
$ifE numConv<>1 $abort '1회 전환 예상 utf_8 -> latin_1'

$callTool.checkErrorLevel gdxservice.gdxEncoding c.gdx -numConv=numConv
$ifE numConv<>1 $abort '1번의 전환 예상 latin_1 -> utf_8'
$call.checkErrorLevel gdxdiff c.gdx corg.gdx > %system.nullFile%

* gdxEncoding은 기호 텍스트나 기호 텍스트가 아닌 레이블의 인코딩만 변경합니다. 
* 설정된 요소 텍스트. 그러한 경우 모든 요소(라벨, 기호,
* 및 설정 요소 텍스트)는 텍스트 파일을 다시 작성하여 변경할 수 있습니다. 
* 한 인코딩에서 다른 인코딩으로 gdxdump에 의해 생성됩니다. 다음 예
*는 다음을 보여줍니다.
$call.checkErrorLevel gdxdump c.gdx > c.org
$onEmbeddedCode 파이썬:
open('c.org', 'r', 인코딩='utf_8')을 f_in으로 사용:
    open('c.latin_1', 'w', 인코딩='latin_1')을 f_out으로 사용:
        f_in의 l에 대해:
            f_out.write(l)
$offEmbeddedCode
$onEmbeddedCode 파이썬:
open('c.latin_1', 'r', 인코딩='latin_1')을 f_in으로 사용:
    open('c.utf_8', 'w', 인코딩='utf_8')을 f_out으로 사용:
        f_in의 l에 대해:
            f_out.write(l)
$offEmbeddedCode
$call.checkErrorLevel diff -q c.org c.utf_8 > %system.nullFile%

* GDX 파일을 다시 만들고 원본과 비교
$call.checkErrorLevel 게임 c.utf_8 lo=2 gdx=c.gdx
$call.checkErrorLevel gdxdiff c.gdx corg.gdx > %system.nullFile%