diff options
author | Eric Wong <e@80x24.org> | 2014-08-25 22:34:40 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-09-22 03:07:56 +0000 |
commit | 6bf9a36e4d86c0c1869f99650b9b05c44200a94c (patch) | |
tree | 6a05065b2895fa1f62c1807798d926dfe64d703d | |
parent | 0c44e3e8672aaadb621a2567fff50e44bdd09f0e (diff) | |
download | dtas-6bf9a36e4d86c0c1869f99650b9b05c44200a94c.tar.gz |
This is the one place we display the filename for users, so it should hopefully make it displayable. Users who care about proper display should use a locale which matches their music collection (or rename their music collection to match).
-rwxr-xr-x | bin/dtas-console | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/dtas-console b/bin/dtas-console index 5747515..c28d92d 100755 --- a/bin/dtas-console +++ b/bin/dtas-console @@ -104,6 +104,9 @@ def rg_string(rg, current) rv end +enc_locale = Encoding.find("locale") +$stdout.set_encoding(enc_locale) +enc_opts = { undef: :replace, invalid: :replace, replace: '?' } begin Curses.init_screen Curses.nonl @@ -118,7 +121,15 @@ begin if current = cur['current'] Curses.setpos(lineno += 1, 0) Curses.clrtoeol - Curses.addstr(current['infile'] || current['command']) + if infile = current['infile'] + # FS encoding != locale encoding, but we need to display an FS path + # name to whatever locale the terminal is encoded to, so force + # it and risk mojibake... + infile.encode(enc_locale, enc_opts) + Curses.addstr(infile) + else + Curses.addstr(current['command']) + end elapsed = Time.now.to_f - current['spawn_at'] if (nr = cur['current_initial']) && (current_format = current['format']) |