I'm asking this question to make sure I'm doing the conversion right and not missing some special case.
This should support special characters as well.
Here's an example program that converts both ways. Is this method correct? Does it cover all special characters?
#include <iostream>
#include <boost/filesystem.hpp>
#include <QString>
int main()
{
QString MyQPath = "abc/مرحبا/geh"; //initial string with arabic characters
boost::filesystem::path MyBPath = MyQPath.toStdWString(); //convert to boost path
std::cout<<MyBPath<<std::endl; //print from boost path, works fine
QString MyQPath2;
MyQPath2 = QString::fromStdWString(MyBPath.wstring()); //convert from boost path to QString
std::cout<<qPrintable(MyQPath2)<<std::endl; //print as UTF-8; works
return 0;
}
Here's the output (in Linux). Although RTL is messed up, but that's alright because it's a terminal issue. I only need to make sure that the information is preserved and not lost in conversions.