From ce8c7b8d8f39dd44a80da70c491bc08a7694dd47 Mon Sep 17 00:00:00 2001 From: Don <496156+nikolat@users.noreply.github.com> Date: Wed, 3 Apr 2024 21:00:23 +0900 Subject: [PATCH] =?UTF-8?q?`GET=20Version`=E3=81=A7`Charset`=E3=83=98?= =?UTF-8?q?=E3=83=83=E3=83=80=E3=82=92=E8=BF=94=E3=81=95=E3=81=AA=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yaya_saori/ayasaori.aym | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/yaya_saori/ayasaori.aym b/yaya_saori/ayasaori.aym index c727ac1..9805963 100644 --- a/yaya_saori/ayasaori.aym +++ b/yaya_saori/ayasaori.aym @@ -84,8 +84,23 @@ request case REQ.COMMAND { when 'GET Version' { + _charset = '' + foreach _header; _line { + if _line == '' + break + _field = SPLIT(_line, ':', 2) + _key = CUTSPACE(_field[0]) + _value = CUTSPACE(_field[1]) + _key = TOUPPER(_key) + if _key == 'CHARSET' { + _charset = _value + break + } + } + REQ.CHARSET = _charset RES.RESULT = GETSETTING('coreinfo.name') + '/' + GETSETTING('coreinfo.version') AYASAORI.Response(STATUS_OK) + ERASEVAR('REQ.CHARSET') return } when 'EXECUTE' { @@ -200,7 +215,13 @@ AYASAORI.Response } else { _charset = REQ.CHARSET } - void SETSETTING('charset.output', _charset) + _unsupported = 127 + if CHARSETTEXTTOID(_charset) == _unsupported { + _charset = GETSETTING('charset.output') + } + elseif !SETSETTING('charset.output', _charset) { + _charset = GETSETTING('charset.output') + } if ISVAR('RES.SENDER') { _sender = RES.SENDER ERASEVAR('RES.SENDER')