[flac-dev] Answering the Hydrogen Audio thread

Ben Allison benski at winamp.com
Tue Mar 5 13:20:23 PST 2013


My worry is more around metadata handling and parsing commandline input. 
You can't pass UTF-8 in setlocale on windows (from the docs: "If you
provide a code page like UTF-7 or UTF-8, setlocale will fail, returning
NULL.").  There is a good chance that the behavior will still be correct
with UTF-8 strings even when in the "C" locale, but I'm not entirely sure.
 If so, you might be correct, we could just add _wmain(), have it convert
the commandline parameters to UTF-8 and call the existing main() function.
 We also have to be sure to open the FLAC objects with either
callback-functions for I/O or with the version where you pass a FILE *
object.

Having proper display from the commandline is another issue entirely (and
a painful one at that).  I have some helper code for console printf that
converts as necessary on Windows - but it's glitchy when combined with
printf calls from elsewhere in the code due to buffering.

-Ben

> Take a look at how the Opus Tools package handles it. So far as I
> remember, it requires minimal changes to the file(s) containing
> references to the main entry point and to fopen. It imports the command
> line arguments as wchar_t and converts them to UTF-8, and has
> replacement functions for fopen and some text output that accept UTF-8
> instead of ANSI. I think it automatically kicks in on definition of
> WIN32, or something like that. Worth a look, at least as a base
> implementation.
>
> On Tue, 5 Mar 2013 11:39:19 -0500
> "Ben Allison" <benski at winamp.com> wrote:
>
>> I would be willing to add Windows Unicode support (and large file
>> mode) to the flac binary tool, but frankly I'm not sure that it could
>> be done as a single cross-platform source file.  There would be a
>> significant amount of either Windows API function calls or
>> MSVC-specific extensions to the C library (like _wfopen).  It would
>> quickly devolve into an #ifdef _MSC_VER mess.
>>
>> >> ktf said:
>> >> No unicode support for Windows either.
>> >
>> > Somebody that knows about windows unicode needs to work on this and
>> > supply a patch. I'm happy to help out with guidance and testing.
>>
>> _______________________________________________
>> flac-dev mailing list
>> flac-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/flac-dev
>
> _______________________________________________
> flac-dev mailing list
> flac-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/flac-dev
>



More information about the flac-dev mailing list