[GH-ISSUE #561] Flac Transcoding with non ASCII Titles #402

Open
opened 2026-02-26 02:33:06 +03:00 by kerem · 6 comments
Owner

Originally created by @mariuskreutzer on GitHub (Mar 16, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/561

The default flac encoding doesn't work with Non-ASCII File names, as escapeshellarg seems to remove these characters by default.
When I insert setlocale(LC_CTYPE, "de_DE.UTF-8");
before the $args line it works.

Originally created by @mariuskreutzer on GitHub (Mar 16, 2017). Original GitHub issue: https://github.com/koel/koel/issues/561 The default flac encoding doesn't work with Non-ASCII File names, as escapeshellarg seems to remove these characters by default. When I insert setlocale(LC_CTYPE, "de_DE.UTF-8"); before the $args line it works.
Author
Owner

@BrookeDot commented on GitHub (Apr 22, 2020):

Can you give the steps to reproduce, for example a file name that is failing?

<!-- gh-comment-id:617566493 --> @BrookeDot commented on GitHub (Apr 22, 2020): Can you give the steps to reproduce, for example a file name that is failing?
Author
Owner

@BrookeDot commented on GitHub (Apr 22, 2020):

Another example from #728

Services/Streamers/TranscodingStreamer.php line 45

   // When escapeshellarg() was stripping my non-ASCII characters from a UTF-8 string, 
  //adding the following fixed the problem:
        setlocale(LC_CTYPE, "en_US.UTF-8");
        $args = [
            '-i '.escapeshellarg($this->song->path),
            '-map 0:0',
            '-v 0',
            "-ab {$bitRate}k",
            '-f mp3',
            '-',
        ];

Possibly could be resolved by allowing a new env setting to set the type.

<!-- gh-comment-id:617599881 --> @BrookeDot commented on GitHub (Apr 22, 2020): Another example from #728 ``` Services/Streamers/TranscodingStreamer.php line 45 // When escapeshellarg() was stripping my non-ASCII characters from a UTF-8 string, //adding the following fixed the problem: setlocale(LC_CTYPE, "en_US.UTF-8"); $args = [ '-i '.escapeshellarg($this->song->path), '-map 0:0', '-v 0', "-ab {$bitRate}k", '-f mp3', '-', ]; ``` Possibly could be resolved by allowing a new `env` setting to set the type.
Author
Owner

@Hyzual commented on GitHub (Apr 25, 2020):

Hi, I can confirm this problem. Here is a filename that reproduces it: 01.エイミー.flac
The same file, when named 12- Glenn Stafford - Zerg Two.flac plays fine.

<!-- gh-comment-id:619371172 --> @Hyzual commented on GitHub (Apr 25, 2020): Hi, I can confirm this problem. Here is a filename that reproduces it: `01.エイミー.flac` The same file, when named `12- Glenn Stafford - Zerg Two.flac` plays fine.
Author
Owner

@sweetlazyboy commented on GitHub (Dec 18, 2020):

I insert
setlocale(LC_CTYPE, "zh_CN.UTF-8");
before the $args line, but still not works.
setlocale(LC_CTYPE, "en_US.UTF-8");
not work, too

<!-- gh-comment-id:748094664 --> @sweetlazyboy commented on GitHub (Dec 18, 2020): I insert setlocale(LC_CTYPE, "zh_CN.UTF-8"); before the $args line, but still not works. setlocale(LC_CTYPE, "en_US.UTF-8"); not work, too
Author
Owner

@bitxel commented on GitHub (Mar 28, 2021):

@sweetlazyboy you need to check whether this locale is in your OS or not by running locale -a

for my case, I need to insert setlocale(LC_CTYPE, "C.UTF-8");

<!-- gh-comment-id:808868682 --> @bitxel commented on GitHub (Mar 28, 2021): @sweetlazyboy you need to check whether this locale is in your OS or not by running `locale -a` for my case, I need to insert `setlocale(LC_CTYPE, "C.UTF-8");`
Author
Owner

@maxysoft commented on GitHub (Jun 1, 2021):

@sweetlazyboy you need to check whether this locale is in your OS or not by running locale -a

for my case, I need to insert setlocale(LC_CTYPE, "C.UTF-8");

I can confirm that the following edit fixed my problem. In that case I have the same locale.

<!-- gh-comment-id:851966509 --> @maxysoft commented on GitHub (Jun 1, 2021): > > > @sweetlazyboy you need to check whether this locale is in your OS or not by running `locale -a` > > for my case, I need to insert `setlocale(LC_CTYPE, "C.UTF-8");` I can confirm that the following edit fixed my problem. In that case I have the same locale.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#402
No description provided.