たぶん、超ニッチな情報だと思うんですが、一応書いておこう :)
QStat の UTF-8 対応はかなりいい加減になっているようなので、以下のように修正すると、Source 系のゲームで日本語のサーバ名等が表示できます。あまりよくわからんのですが、Source 系は既に UTF-8 でサーバ名等を返してくるので、わざわざ Unicode から UTF-8 に変換しなくてもいいって感じなのかな。
% svn diff qstat.c
Index: qstat.c
===================================================================
--- qstat.c (revision 310)
+++ qstat.c (working copy)
@@ -11771,7 +11771,7 @@
static unsigned char _buf[4][MAXSTRLEN + 8];
static int _buf_index = 0;
unsigned char *result, *b, *end;
- unsigned int c;
+ unsigned char c;
if (string == NULL)
{
@@ -11843,7 +11843,7 @@
{
fprintf(stderr, "Encoding error (%d) for U+%x, D+%d\n", 1, c, c);
}
- else if (xml_encoding == ENCODING_LATIN_1)
+ else if (xml_encoding == ENCODING_LATIN_1 || xml_encoding == ENCODING_UTF_8)
{
if (!name_xforms)
{
実行例はこんな感じ。
% qstat -utf8 -xml -a2s 121.113.186.235:27015
<?xml version="1.0" encoding="UTF-8"?>
<qstat>
<server type="A2S" address="121.113.186.235:27015" status="UP">
<hostname>121.113.186.235:27015</hostname>
<name>[JP](test-L) 鉄砲倶楽部/部室</name>
<gametype>cstrike</gametype>
<map>de_dust2</map>
<numplayers>0</numplayers>
<maxplayers>32</maxplayers>
<numspectators>0</numspectators>
<maxspectators>0</maxspectators>
<ping>47</ping>
<retries>0</retries>
</server>
</qstat>
ちなみに -utf8 をつけないとこんな感じ。
% qstat -xml -a2s 121.113.186.235:27015
<?xml version="1.0" encoding="iso-8859-1"?>
<qstat>
<server type="A2S" address="121.113.186.235:27015" status="UP">
<hostname>121.113.186.235:27015</hostname>
<name>[JP](test-L) IG 2E(6F%=I(/I(E.$</name>
<gametype>cstrike</gametype>
<map>de_dust2</map>
<numplayers>0</numplayers>
<maxplayers>32</maxplayers>
<numspectators>0</numspectators>
<maxspectators>0</maxspectators>
<ping>31</ping>
<retries>0</retries>
</server>
</qstat>
コメント (5)
さっそく書いてくださってありがとうございます :D
投稿者: khaos | 2008年06月27日 01:31
日時: 2008年06月27日 01:31
HLSWのWeblistに対応していますか?
投稿者: noon | 2008年07月15日 20:22
日時: 2008年07月15日 20:22
このフォーマットのことですかね。
http://wiki.hlsw.net/index.php/SSLF_-_Shared_Server_List_Format
対応できそうなので、検討してみます。
投稿者: Guwashi | 2008年07月19日 22:53
日時: 2008年07月19日 22:53
SSLF フォーマットに対応しました :)
投稿者: Guwashi | 2008年07月20日 00:57
日時: 2008年07月20日 00:57
人数のところの()って何を表してるんですか?人間の数?
投稿者: yoshi | 2008年11月29日 10:16
日時: 2008年11月29日 10:16