Project

General

Profile

Bug #823

Audtool doesn't output UTF-8 on Windows

Added by Domen Mori about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Minor
Assignee:
-
Category:
audtool
Target version:
Start date:
August 25, 2018
Due date:
% Done:

100%

Estimated time:
1.00 h
Affects version:

Description

This can be observed when output contains special characters. For example:

$ audtool current-song
▒ank Rock - Nekaj Ve? - Ni Sre?e Brez Rock N Rolla

I found a simple fix, based on: https://stackoverflow.com/questions/43927373/force-utf-8-encoding-in-glibs-g-print
Tried adding into audtool/main.c:
#ifdef WIN32
void g_print_no_convert(const gchar *buf)
{
    fputs(buf, stdout);
}
#endif

And inside main function:

#ifdef WIN32
    g_set_print_handler(g_print_no_convert);
#endif

After compiling with this fix, it works correctly:

$ audtool current-song
Šank Rock - Nekaj Več - Ni Sreče Brez Rock N Rolla

I could submit a pull request, but as I am not very experienced in this type of programs and libraries, I am not sure if this will have negative implications on other parts of the program.

History

#1 Updated by John Lindgren about 6 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

That didn't quite work for me (at least not when using the real Windows console in a US English locale).

This worked:
https://github.com/audacious-media-player/audacious/commit/dec82a8d6a23fec13cd92e9761ad63bbe719eb25

I think it should be a complete fix, but please let me know if you still have trouble.

Also available in: Atom PDF