WebString.cpp 490 B

12345678910111213141516171819202122232425262728
  1. #include <include/cef_client.h>
  2. #include "WebString.h"
  3. namespace Atomic
  4. {
  5. bool ConvertCEFString(const CefString& cefString, String& output)
  6. {
  7. output = "Failed to Convert CefString";
  8. cef_string_utf8_t utf8;
  9. memset(&utf8, 0, sizeof(utf8));
  10. if (!cef_string_utf16_to_utf8(cefString.c_str(), cefString.length(), &utf8))
  11. {
  12. cef_string_utf8_clear(&utf8);
  13. return false;
  14. }
  15. output = utf8.str;
  16. cef_string_utf8_clear(&utf8);
  17. return true;
  18. }
  19. }