diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index ebf424a61..d4d4a9766 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -347,15 +347,16 @@ namespace mapnik { for (;pos!=val.end();++pos) { wchar_t c = *pos; - if (c < 0x7f) + if (c < 0x80) { ss << char(c); } else { ss << "\\x"; - ss << ((c >> 8) & 0xff); - ss << (c & 0xff); + unsigned c0 = (c >> 8) & 0xff; + if (c0) ss << c0; + ss << (c & 0xff); } } return ss.str(); @@ -375,7 +376,9 @@ namespace mapnik { template std::wstring operator() (T val) const { - return L"TODO"; + std::basic_ostringstream out; + out << val; + return out.str(); } // specializations std::wstring const& operator() (std::wstring const& val) const @@ -394,18 +397,19 @@ namespace mapnik { for (;pos!=val.end();++pos) { wchar_t c = *pos; - if (c < 0x7f) + if (c < 0x80) { ss << char(c); } else { ss << "\\x"; - ss << ((c >> 8) & 0xff); - ss << (c & 0xff); + unsigned c0 = (c >> 8) & 0xff; + if (c0) ss << c0; + ss << (c & 0xff); } } - return ss.str(); + return "\'" + ss.str() + "\'"; } template