zerratar / SubSync

Automatically download subtitles for your movies
MIT License
290 stars 26 forks source link

Program not working for paths with cyrillic letter #5

Closed shnaps closed 6 years ago

shnaps commented 6 years ago

SubSync doesn't work when it has cyrillic letter in a path. I tried couple paths, same error everytime

BlackDragonBE commented 6 years ago

@zerratar This can be fixed by using UTF-8 encoding when manipulating strings and streams. This way, Arabic and Greek characters are also be supported on top of Latin and Cyrillic.
Some examples: https://www.arclab.com/en/kb/csharp/read-write-text-file-ansi-utf8-unicode.html

zerratar commented 6 years ago

@BlackDragonBE Unfortunately the problem is not reading/writing files but the actual filepath that is passed by the args parameter when starting SubSync that for some reason is not unicode when @shnaps tried to use it. So the filesystemwatcher crashes when it gets folder path containing questionmarks.

Latest version atleast support displaying unicode In the console so the cyrillic chars does display correctly.

@shnaps: can you try and run SubSync from the same folder you want to watch and without passing any input folder as parameter? That should force it to run in current directory.

If it works then we know that it can handle cyrillic paths and that the input was not passed as unicode from the console because the videofile you had contains cyrillic chars in it.

shnaps commented 6 years ago

@zerratar Yep, it works.

zerratar commented 6 years ago

@shnaps Awesome that it works for you!

Less awesome part is that it confirms my theory that the program used for inputting the directory that is not passing the values as Unicode. And I can't do anything about that since the problem does not lie with SubSync.

However! There are other ways to go around it. If you create a shortcut to SubSync.exe and pass the folder you want to sync in along with the target and it will work.

See screenshot here

zerratar commented 6 years ago

I will close this issue now, please make a new one if you find any new problems and thank you for reporting this!

@BlackDragonBE even though that was not the solution to this problem, I really appreciate that you wanted to help out. So I hope that my comment was not too harsh/or if you took it the w rong way! If so, I'm very sorry!

BlackDragonBE commented 6 years ago

@zerratar No offense taken! This an interesting problem and gave me food for thought for my own projects.