[GH-ISSUE #2] Files with non ASCII characters do not get saved correctly #1

Closed
opened 2026-02-26 02:31:45 +03:00 by kerem · 10 comments
Owner

Originally created by @juliusvdijk on GitHub (Dec 13, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/2

In my library there is a file "Major Lazer & DJ Snake - Lean On (feat. MØ) (Official Music Video).mp3" which is unplayable because the file path is stored as "Major Lazer & DJ Snake - Lean On (feat. M?) (Official Music Video).mp3".

I am able to store the Ø character in the song table which also fixes the playback issue.

This issue is happening with all non ASCII characters.

Originally created by @juliusvdijk on GitHub (Dec 13, 2015). Original GitHub issue: https://github.com/koel/koel/issues/2 In my library there is a file "Major Lazer & DJ Snake - Lean On (feat. MØ) (Official Music Video).mp3" which is unplayable because the file path is stored as "Major Lazer & DJ Snake - Lean On (feat. M?) (Official Music Video).mp3". I am able to store the Ø character in the song table which also fixes the playback issue. This issue is happening with all non ASCII characters.
kerem closed this issue 2026-02-26 02:31:45 +03:00
Author
Owner

@phanan commented on GitHub (Dec 13, 2015):

Hmm. What DBMS are you using? I have quite a few Chinese songs in my MySQL and it works fine:

image

<!-- gh-comment-id:164260915 --> @phanan commented on GitHub (Dec 13, 2015): Hmm. What DBMS are you using? I have quite a few Chinese songs in my MySQL and it works fine: ![image](https://cloud.githubusercontent.com/assets/8056274/11767282/6dece2e2-a1e3-11e5-8050-908d316034d4.png)
Author
Owner

@phanan commented on GitHub (Dec 13, 2015):

And

image

<!-- gh-comment-id:164261593 --> @phanan commented on GitHub (Dec 13, 2015): And ![image](https://cloud.githubusercontent.com/assets/8056274/11767319/92289a74-a1e4-11e5-9f46-99b71b5ec275.png)
Author
Owner

@juliusvdijk commented on GitHub (Dec 13, 2015):

I am using MySQL on Windows using XAMPP.

In the console I am able to view the correct path so for some reason it just does not want to save in the right encoding. I tried to convert the encoding with mb_convert_encoding but that did not work.

However the title field gets saved succesfully...
Title: Major Lazer (Feat. MØ & DJ Snake) - Lean On (Claes Lanng Tropical Mix)
Path: .......\Major Lazer - Lean On (feat. M? & DJ Snake).mp3

<!-- gh-comment-id:164262607 --> @juliusvdijk commented on GitHub (Dec 13, 2015): I am using MySQL on Windows using XAMPP. In the console I am able to view the correct path so for some reason it just does not want to save in the right encoding. I tried to convert the encoding with mb_convert_encoding but that did not work. However the title field gets saved succesfully... Title: Major Lazer (Feat. MØ & DJ Snake) - Lean On (Claes Lanng Tropical Mix) Path: .......\Major Lazer - Lean On (feat. M? & DJ Snake).mp3
Author
Owner

@phanan commented on GitHub (Dec 13, 2015):

I don't have a Windows box here, so... can you dd($file->getPathname()) here and see if it's a PHP problem?

<!-- gh-comment-id:164270529 --> @phanan commented on GitHub (Dec 13, 2015): I don't have a Windows box here, so... can you `dd($file->getPathname())` [here](https://github.com/phanan/koel/blob/master/app/Services/Media.php#L122) and see if it's a PHP problem?
Author
Owner

@juliusvdijk commented on GitHub (Dec 13, 2015):

I've added this code:

        if ($syncCommand) {
            $syncCommand->info($file->getPathname());
        }

I ran php artisan koel:sync --verbose and got this output.

.........\\Major Lazer - Lean On (feat. MØ & DJ Snake).mp3
Major Lazer - Lean On (feat. MØ & DJ Snake).mp3 has no changes – ignoring

In the database it is stored as:

.........\\Major Lazer - Lean On (feat. M? & DJ Snake).mp3
Major Lazer (Feat. MØ & DJ Snake) - Lean On (Claes Lanng Tropical Mix)
<!-- gh-comment-id:164271156 --> @juliusvdijk commented on GitHub (Dec 13, 2015): I've added this code: ``` if ($syncCommand) { $syncCommand->info($file->getPathname()); } ``` I ran php artisan koel:sync --verbose and got this output. ``` .........\\Major Lazer - Lean On (feat. MØ & DJ Snake).mp3 Major Lazer - Lean On (feat. MØ & DJ Snake).mp3 has no changes – ignoring ``` In the database it is stored as: ``` .........\\Major Lazer - Lean On (feat. M? & DJ Snake).mp3 Major Lazer (Feat. MØ & DJ Snake) - Lean On (Claes Lanng Tropical Mix) ```
Author
Owner

@phanan commented on GitHub (Dec 13, 2015):

Just to double-check, what encoding is there for the field/table/db?

<!-- gh-comment-id:164271270 --> @phanan commented on GitHub (Dec 13, 2015): Just to double-check, what encoding is there for the field/table/db?
Author
Owner

@juliusvdijk commented on GitHub (Dec 13, 2015):

DB collation

The weirdest thing is that it saves the title from the ID3 tags correctly but not the path.

I overrode the updateOrCreate and the value of the path is still correct, I have no clue why that character gets converted to a ?.

<!-- gh-comment-id:164271334 --> @juliusvdijk commented on GitHub (Dec 13, 2015): ![DB collation](http://i.imgur.com/MIHSY0d.png) The weirdest thing is that it saves the title from the ID3 tags correctly but not the path. I overrode the updateOrCreate and the value of the path is still correct, I have no clue why that character gets converted to a ?.
Author
Owner

@phanan commented on GitHub (Dec 14, 2015):

I don't know honestly. Once you enter updateOrCreate(), it's the framework (Laravel) job. From what I know, there's no configuration that may affect this. Maybe open an issue here?

<!-- gh-comment-id:164321745 --> @phanan commented on GitHub (Dec 14, 2015): I don't know honestly. Once you enter `updateOrCreate()`, it's the framework (Laravel) job. From what I know, there's no configuration that may affect this. Maybe open an issue [here](https://github.com/laravel/framework/)?
Author
Owner

@juliusvdijk commented on GitHub (Dec 14, 2015):

It seems to be an issue related to my PHP environment, I'll try running it in a virtual Linux environment to check if that fixes it.

<!-- gh-comment-id:164369008 --> @juliusvdijk commented on GitHub (Dec 14, 2015): It seems to be an issue related to my PHP environment, I'll try running it in a virtual Linux environment to check if that fixes it.
Author
Owner

@phanan commented on GitHub (Dec 14, 2015):

👍 I'll go ahead and close this issue then. Feel free to open a new one if the problem persists for you.

<!-- gh-comment-id:164387234 --> @phanan commented on GitHub (Dec 14, 2015): :+1: I'll go ahead and close this issue then. Feel free to open a new one if the problem persists for you.
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#1
No description provided.