criticablog

ソフトウェアエンジニアがニッチな情報を書きます。

Debian Chrome で半角文字だけ文字化けする

Google Chrome のURLバーやメニューなどで、英数字が表示されるべき部分だけ全角記号やひらがなに置き換わってしまう問題が起きていた。Debian では fonts-droid パッケージを更新すると直る。

Chrome 以外にも同じ文字化けをしたアプリがあった気がして、現象も一言で言いづらいし、Debian (fontconfig) か KDE の問題か切り分けられてもいなかったので1ヶ月ほど放置していた。 さっき4〜5回ググって chrome フォント 半角 文字化け というキーワードで数ヶ月以内の記事を探したら上記の二つの記事が見つかった。

問題のパッケージをアンインストールできるかなと aptitude で見てみれば fonts-droid 1:4.4.4r2-2 という更新があったのでとりあえずインストール

Retrieving bug reports... Done
Parsing Found/Fixed information... Done
Reading changelogs... Done
debconf: apt-extracttemplates failed: Illegal seek
(Reading database ... 456082 files and directories currently installed.)
Preparing to unpack .../fonts-droid_1%3a4.4.4r2-2_all.deb ...
Unpacking fonts-droid (1:4.4.4r2-2) over (1:4.4.3r1.1-1) ...
Processing triggers for fontconfig (2.11.0-6.1) ...
[master 1ce1037] committing changes in /etc after apt run
 1 file changed, 1 deletion(-)
 delete mode 120000 fonts/conf.d/65-droid-sans-fonts.conf
Press Return to continue.

/etc/fonts/conf.d/65-droid-sans-fonts.conf が削除され、Chrome を再起動すると直った。

使用している Chrome は 37.0.2062.3-1 (Google 公式)

ちなみに愛用しているフォントは VL Gothic です。0 と O, I と l の区別がつきやすい。

Best practice to run PowerShell scripts from Jenkins

Step-by-step

  1. Choose “Execute Windows batch command”.

  2. Paste this to print out command-lines itself to the console:

@echo off
type %0
echo.
  1. Surround your PowerShell script like this:
powershell -noprofile -command "$ErrorActionPreference = 'Stop'; Set-PsDebug -Strict; .\Do-YourJob.ps1"
  1. If your script contains external commands (like .exes or .cmds), test each exit code of them by $LASTEXITCODE:
bcp.exe blah blah
if ($LASTEXITCODE -ne 0) throw "bcp exit with $LASTEXITCODE"

Explanations

$ErrorActionPreference = 'Stop' makes powershell.exe exit with non-zero when an exception is thrown in the script (maybe).

Set-PsDebug -Strict causes an exception when a variable is used before its assignment, otherwise an uninitialized variable results $null.

Usually powershell.exe returns zero exit code (means success in Jenkins) even if the last command exit with non-zero (means failure).

The PowerShell plugin allows you to write PowerShell codes directly but I thought it would be hard to catch some kind of errors. Probably due to its invocation i.e.:

powershell.exe "& 'C:\Windows\TEMP\hudson########.ps1'" 

Nexus 7 のブラウザと webview は 別物

Chrome がプリインストールされてても、アプリ内に組み込んで使える WebView はただの WebKit ですよって話。

Nexus 7 にプリインストールされてる唯一のブラウザ Chrome で 確認くん*1 を見た様子

ブラウザーとOS Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JWR66Y) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Safari/537.36
サポート言語 en-US,en;q=0.8,ja;q=0.6
エンコードの仕様 gzip,deflate,sdch
MIMEの仕様 text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

はてブ アプリ*2 の内部ブラウザで 診断くん*3 を見た様子

HTTP_ACCEPT_ENCODING gzip,deflate
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_CHARSET utf-8, iso-8859-1, utf-16, *;q=0.7
HTTP_USER_AGENT Mozilla/5.0 (Linux; U; Android 4.3; en-us; Nexus 7 Build/JWR66Y) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
HTTP_ACCEPT_LANGUAGE en-US

感想

例えば デバイス フィンガープリンティング技術でも別デバイスとして判定されることでしょう。
Chrome 搭載端末が増えても、Android 標準ブラウザみたいなものへの配慮はいつまでも必要かも。

ちなみに端末の言語設定を英語にしてあります。