Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencc中文路径问题 #654

Closed
wants to merge 11 commits into from
13 changes: 12 additions & 1 deletion src/rime/gear/simplifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
#include <opencc/Dict.hpp>
#include <opencc/DictEntry.hpp>

static const char* quote_left = "\xe3\x80\x94"; //"\xef\xbc\x88";
#ifdef WIN32
#include <opencc/UTF8Util.hpp>
namespace fs = boost::filesystem;
#endif

static const char* quote_left = "\xe3\x80\x94"; //"\xef\xbc\x88";

static const char* quote_right = "\xe3\x80\x95"; //"\xef\xbc\x89";

namespace rime {
Expand All @@ -36,7 +42,12 @@ class Opencc {
LOG(INFO) << "initializing opencc: " << config_path;
opencc::Config config;
try {
#ifdef WIN32
fs::path path{ config_path };
converter_ = config.NewFromFile(opencc::UTF8Util::U16ToU8(path.wstring()));
#else
converter_ = config.NewFromFile(config_path);
#endif
const list<opencc::ConversionPtr> conversions =
converter_->GetConversionChain()->GetConversions();
dict_ = conversions.front()->GetDict();
Expand Down