mirror of
https://github.com/koel/koel.git
synced 2026-04-25 08:46:00 +03:00
[GH-ISSUE #68] On Windows we get GBK, not UTF8 #50
Labels
No labels
Authentication
Dependencies
Documentation
Feature Request
Flac
Help Wanted
Installation/Setup
Integration
Mobile
PR Welcome
Pending Release
Performance
Playlist
S3
Search
Sync
[Pri] Low
[Pri] Normal
[Status] Keep Open
[Status] Needs Author Reply
[Status] Needs Review
[Status] Stale
[Status] Will Implement
[Type] Blessed
[Type] Bug
[Type] Duplicate
[Type] Enhancement
[Type] Help Request
[Type] Question
[Type] Task
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/koel-koel#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @baozijianke on GitHub (Dec 16, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/68
I use a macbook and a thinkpad, so I tried Koel both on Mac OS and Windows. When I use my Windows platform I met a problem similar to @Merccy https://github.com/phanan/koel/issues/2.
I have a lot of Chinese songs and Korean songs. What I found is that after excuteing koel:sync I can's save the Chinese song's name into the database, and can't get the name of Korean songs.
and it tells me that the name is valid, I can find nothing about these songs in the database.
eg: the real path is " C:/MusicBase/xxx一首纯中文歌曲.mp3 " , in the databse we can only see "C:/MusicBase/xxx" , if the path changes to " C:/歌曲库/xxx一首纯中文歌曲.mp3 ", we can only get "C:/" in the database.
I'm not familiar with PHP and Laravel or Symfony, I just read some of the codes and do some tests.
It seems that u use Symfony's component Finder to get the path of songs, so before the path being saved to database I add some codes to convert the path from GBK to UTF8, and the chinese songs' correct paths are shown in the database.
So I GUESS it's the problem of the default character setting. Windows use GBK. But GBK only supports most Chinese characters, Korean is not supported. So I can't get the Korean songs' path and I can get the Chinese song's path but can's save it to the database correctly.
I'm not skilled with English, if there is anything not clear, pls notice me. Thanks.
@phanan commented on GitHub (Dec 16, 2015):
This is to my knowledge a limitation of PHP 5.x on Windows. Can you try upgrading to PHP 7 as a workaround, and see if it works out?
@baozijianke commented on GitHub (Dec 16, 2015):
Oh I'm so sorry I didn't attach my system information.
Yes, I followed your wiki to install Koel, so I'm using PHP7.0
Windows10 Edu
Apache/2.4.18 (Win32)
Laravel 5.1
PHP/7.0.0
5.7.10-log - MySQL Community Server (GPL)
@phanan commented on GitHub (Dec 16, 2015):
Hmm. You mentioned to have added some code to convert from GBK to UTF8, can you share with me the code?
@baozijianke commented on GitHub (Dec 16, 2015):
OK.
In fact, in my test I use iconv("GBK","UTF-8//IGNORE",$string) .
I just searched this in Google and had a try.
@baozijianke commented on GitHub (Dec 16, 2015):
http://www.php.net/manual/en/function.iconv.php
here is the document of iconv.
@phanan commented on GitHub (Dec 16, 2015):
Strange. I've just tested in a Windows VM, the function works fine for me:
@baozijianke commented on GitHub (Dec 16, 2015):
em......My test is not the same as yours.

maybe it's the Symfony/Finder 's problem? I'm not sure.
I add 3 songs, one english song, one korean song ,one chinese song.
Below is what I see in chrome. chrome is using UTF-8 by default.
Forgive my ugly writings.
@phanan commented on GitHub (Dec 16, 2015):
Your sample doesn't work for me though. This appears to be a long-known issue with PHP – Unicode settings on Windows, which unfortunately I don't have enough time to look for a workaround now. I'd suggest you keep the current local fix if it works for you.