Open RollingStar opened 5 years ago
Hmm... I’m not sure what to do here. We do need to use arg_encoding
or something like it---this is the bit of the convert plugin that constructs the command to invoke, so we need to use the encoding that the system expects for command-line arguments.
On Unix, the right thing to do here would be to interpolate the raw bytes from the filename string. On Windows, filenames are proper Unicode---so, as far as I know, Windows should be reporting a Unicode argument encoding. I'm not sure why your system isn't (encodings on Windows are a great mystery to me!). Do you know what encoding it's try to use and---while this is a long shot---why it's doing that?
@sampsyo looks to me like util.arg_encoding()
is returning cp1252
(see third line from the bottom in the stack trace).
I can confirm that on my Windows 10 machine, arg_encoding()
returns cp1252
(the second item in the array returned by locale.getdefaultlocale()
as of time of writing), which I assume isn't what we want/expected;
It seems that sys.getfilesystemencoding()
returns utf-8
for me, but I feel like that's different to argument encoding.
Got it; thanks! That's not really what I expected, but I suppose what we need to do is to "pass through" filenames without trying to use the argument encoding for them at all. That will be tricky to do while still using template formatting… but maybe we can figure out a strategy?
I can confirm that on my Windows 10 machine,
arg_encoding()
returnscp1252
(the second item in the array returned bylocale.getdefaultlocale()
as of time of writing)
Same here.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Yes
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Got it; thanks! That's not really what I expected, but I suppose what we need to do is to "pass through" filenames without trying to use the argument encoding for them at all. That will be tricky to do while still using template formatting… but maybe we can figure out a strategy?
I'll mark this as a bug.
Problem
Arg_encoding leads to a non-Unicode encoding being used. The paths need to be unicode to make Japanese characters, so they fail.
https://github.com/beetbox/beets/blob/master/beetsplug/convert.py#L222
https://github.com/beetbox/beets/blob/master/beets/util/__init__.py#L319
When I hardcode the
try:
block to "utf-8", the problem is fixed.2019-10-28 edit: Hardcode
arg_encoding
to always return'utf-8'
.https://github.com/beetbox/beets/blob/1b187fbf5345727e0dfdaea958a714f19e917a4e/beets/util/__init__.py#L328
I haven't set my default codepage to UTF8, but the process has side-effects on Windows so I don't know if that's what users should be expected to do.
My terminal can print special characters just fine, and beets has been able to write paths with special characters as well. This leads me to conclude that calling
arg_encoding()
isn't the right move here.Running this command in verbose (
-vv
) mode:Setup