Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7772 Next »

std::string FB::wstring_to_utf8 ( const std::wstring &  src)

Accepts a std::wstring and returns a UTF8-encoded std::string.

Parameters
srcSource string
Returns
UTF8-encoded std::string

Definition at line 37 of file utf8_tools.cpp.

Referenced by FB::DOM::Window::alert(), FB::BrowserHost::evaluateJavaScript(), FB::JSAPIImpl::FireEvent(), FB::DOM::Element::getElementsByTagName(), FB::ActiveX::AXDOM::Window::getLocation(), FB::ActiveX::IDispatchAPI::getMemberNames(), FB::JSAPI::GetMethodObject(), FB::DOM::Node::getNode(), FB::DOM::Node::getProperty(), FB::JSAPI::GetProperty(), FB::JSAPI::HasMethod(), FB::JSAPI::HasMethodObject(), FB::ActiveX::IDispatchAPI::HasProperty(), FB::JSAPI::HasProperty(), FB::JSAPI::Invoke(), FB::JSAPIImpl::registerEvent(), FB::JSAPI::registerEventMethod(), FB::JSAPIImpl::registerEventMethod(), FB::JSAPI::RemoveProperty(), FB::DOM::Node::setProperty(), FB::JSAPI::SetProperty(), FB::JSAPI::unregisterEventMethod(), and FB::JSAPIImpl::unregisterEventMethod().

37  {
38  std::string out_str;
39  std::wstring in_str;
40  utf8::replace_invalid(src.begin(), src.end(), std::back_inserter(in_str));
41 #ifdef _WIN32
42  utf8::utf16to8(in_str.begin(), in_str.end(), std::back_inserter(out_str));
43 #else
44  utf8::utf32to8(in_str.begin(), in_str.end(), std::back_inserter(out_str));
45 #endif
46  return out_str;
47  }
  • No labels