Debugging Locale of libarchive
程程编里不是这样的!😡应该多让我看看libarchive源码☝,然后提升我的好感度。偶尔让我发现一些灵感,然后在那个特殊函数时跟我有特殊返回值☺️。最后在某个我trace了很久才找到的语句,让我发现错误😮,我终于找到问题根源☺️,然后我成功提交PR啊😃。一怎么上来给我跳转到libiconv!😡?程程编里根本不是这样!😡我不接受!!😡😡😡
If you found you can’t use your locale in libarchive (in which case you probably could only use C locale), you should probably know this knowledge (in https://en.cppreference.com/w/cpp/locale/setlocale.html):
During program startup, the equivalent of
std::setlocale(LC_ALL, "C");is executed before any user code is run.
So you should call setlocale before using libarchive. It’s implied in libarchive wiki and Issue 587, but I didn’t find any words related.
It’s also worth noting that <text_encoding> is interesting, to help the problem.
This post is licensed under
CC BY 4.0
by the author.