cjlin1 / libsvm

LIBSVM -- A Library for Support Vector Machines
https://www.csie.ntu.edu.tw/~cjlin/libsvm/
BSD 3-Clause "New" or "Revised" License
4.55k stars 1.64k forks source link

Add Chinese file path support to svm_load_model and svm_save_model #61

Closed ArcticLampyrid closed 5 years ago

ArcticLampyrid commented 7 years ago

@cjlin1

cjlin1 commented 5 years ago

Thank you for the pull request. A concern of using sys.getfilesystemencoding() is that if the system setting isn't correct, it's unclear what the returned value is.. We now decide to always transform the string to utf-8 and have the follwing changes in the next release.

diff --git a/python/svmutil.py b/python/svmutil.py index 8b50edd..a1a043e 100644 --- a/python/svmutil.py +++ b/python/svmutil.py @@ -11,7 +11,10 @@ from commonutil import all as common_all if sys.version_info[0] < 3: range = xrange from itertools import izip as zip

@@ -21,7 +24,7 @@ def svm_load_model(model_file_name):

Load a LIBSVM model from model_file_name and return.
"""
ArcticLampyrid commented 5 years ago

But this decision will result in the library not being able to access files with non-ascii characters in their names on most Windows systems (and some Linux systems).

The library has no reason to handle errors when the System Settings are incorrect.