Make down-conversion explicit from CFX_Widetring to CFX_WideStringC.

Companion to https://codereview.chromium.org/1853233002

BUG=

Review URL: https://codereview.chromium.org/1857073002
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index ad21db8..2555d48 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -335,7 +335,7 @@
   } else {
     return false;
   }
-  *csFileName = DecodeFileName(*csFileName);
+  *csFileName = DecodeFileName(csFileName->AsWideStringC());
   return true;
 }
 
diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp
index b39c32b..d59a6b9 100644
--- a/core/fxcrt/fx_xml_parser.cpp
+++ b/core/fxcrt/fx_xml_parser.cpp
@@ -398,7 +398,8 @@
       CFX_WideString attr_value;
       GetAttrValue(attr_value);
       pElement->m_AttrMap.SetAt(attr_space.AsByteStringC(),
-                                attr_name.AsByteStringC(), attr_value);
+                                attr_name.AsByteStringC(),
+                                attr_value.AsWideStringC());
     }
     m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
     if (m_dwIndex < m_dwBufferSize || IsEOF()) {
@@ -461,7 +462,7 @@
             if (!bCDATA && !m_bSaveSpaceChars) {
               dataStr.TrimRight(L" \t\r\n");
             }
-            InsertContentSegment(bCDATA, dataStr, pElement);
+            InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement);
             content.Clear();
             decoder.Clear();
             bCDATA = FALSE;
@@ -505,7 +506,7 @@
   if (!m_bSaveSpaceChars) {
     dataStr.TrimRight(L" \t\r\n");
   }
-  InsertContentSegment(bCDATA, dataStr, pElement);
+  InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement);
   content.Clear();
   decoder.Clear();
   bCDATA = FALSE;
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
index d48b26c..9373b05 100644
--- a/core/fxcrt/include/fx_string.h
+++ b/core/fxcrt/include/fx_string.h
@@ -431,8 +431,6 @@
     m_Length = src.m_Length;
   }
 
-  CFX_WideStringC(const CFX_WideString& src);
-
   CFX_WideStringC& operator=(const FX_WCHAR* src) {
     m_Ptr = src;
     m_Length = FXSYS_wcslen(src);
@@ -557,13 +555,20 @@
   static FX_STRSIZE WStringLength(const unsigned short* str);
 
   // Explicit conversion to C-style wide string.
+  // Note: |this| must outlive the use of the result.
   const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; }
 
   // Implicit conversion to C-style wide string -- deprecated.
+  // Note: |this| must outlive the use of the result.
   operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; }
 
-  void Empty();
+  // Explicit conversion to CFX_WideStringC.
+  // Note: |this| must outlive the use of the result.
+  CFX_WideStringC AsWideStringC() const {
+    return CFX_WideStringC(c_str(), GetLength());
+  }
 
+  void Empty();
   bool IsEmpty() const { return !GetLength(); }
   FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
 
@@ -685,10 +690,7 @@
   StringData* m_pData;
   friend class fxcrt_WideStringConcatInPlace_Test;
 };
-inline CFX_WideStringC::CFX_WideStringC(const CFX_WideString& src) {
-  m_Ptr = src.c_str();
-  m_Length = src.GetLength();
-}
+
 inline CFX_WideStringC& CFX_WideStringC::operator=(const CFX_WideString& src) {
   m_Ptr = src.c_str();
   m_Length = src.GetLength();
@@ -715,29 +717,29 @@
 }
 inline CFX_WideString operator+(const CFX_WideString& str1,
                                 const CFX_WideString& str2) {
-  return CFX_WideString(str1, str2);
+  return CFX_WideString(str1.AsWideStringC(), str2.AsWideStringC());
 }
 inline CFX_WideString operator+(const CFX_WideString& str1, FX_WCHAR ch) {
-  return CFX_WideString(str1, CFX_WideStringC(ch));
+  return CFX_WideString(str1.AsWideStringC(), CFX_WideStringC(ch));
 }
 inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideString& str2) {
-  return CFX_WideString(ch, str2);
+  return CFX_WideString(ch, str2.AsWideStringC());
 }
 inline CFX_WideString operator+(const CFX_WideString& str1,
                                 const FX_WCHAR* str2) {
-  return CFX_WideString(str1, str2);
+  return CFX_WideString(str1.AsWideStringC(), str2);
 }
 inline CFX_WideString operator+(const FX_WCHAR* str1,
                                 const CFX_WideString& str2) {
-  return CFX_WideString(str1, str2);
+  return CFX_WideString(str1, str2.AsWideStringC());
 }
 inline CFX_WideString operator+(const CFX_WideString& str1,
                                 const CFX_WideStringC& str2) {
-  return CFX_WideString(str1, str2);
+  return CFX_WideString(str1.AsWideStringC(), str2);
 }
 inline CFX_WideString operator+(const CFX_WideStringC& str1,
                                 const CFX_WideString& str2) {
-  return CFX_WideString(str1, str2);
+  return CFX_WideString(str1, str2.AsWideStringC());
 }
 inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) {
   return rhs == lhs;
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index fbc05bd..bb8793f 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -957,7 +957,7 @@
     ws.FromLocal("data");
     CFX_ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
     fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength());
-    m_pXFADoc->SavePackage(ws, &fileStream);
+    m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream);
   } else if (fileType == FXFA_SAVEAS_XDP) {
     if (flag == 0)
       flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
@@ -1018,11 +1018,11 @@
       if (pPrePDFObj->GetString() == "form") {
         CFX_WideString ws;
         ws.FromLocal("form");
-        m_pXFADoc->SavePackage(ws, &fileStream);
+        m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream);
       } else if (pPrePDFObj->GetString() == "datasets") {
         CFX_WideString ws;
         ws.FromLocal("datasets");
-        m_pXFADoc->SavePackage(ws, &fileStream);
+        m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream);
       } else {
         // PDF,creator.
       }
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index fe7c2393..3dad624 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -64,7 +64,7 @@
         }
 
         if (!sName.IsEmpty())
-          m_hMixXFAWidget = pDocView->GetWidgetByName(sName);
+          m_hMixXFAWidget = pDocView->GetWidgetByName(sName.AsWideStringC());
       }
     }
     return m_hMixXFAWidget;
@@ -80,7 +80,7 @@
     if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
       CFX_WideString sName = GetName();
       if (!sName.IsEmpty())
-        return pDocView->GetWidgetByName(sName);
+        return pDocView->GetWidgetByName(sName.AsWideStringC());
     }
   }
 
@@ -2448,7 +2448,7 @@
     bool bIncludeOrExclude,
     CFX_ByteTextBuf& textBuf) {
   std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
-      m_pDocument->GetPath(), fields, bIncludeOrExclude));
+      m_pDocument->GetPath().AsWideStringC(), fields, bIncludeOrExclude));
   return pFDF ? pFDF->WriteBuf(textBuf) : FALSE;
 }
 
@@ -2486,7 +2486,8 @@
 
   CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
   CFX_WideString wsPDFFilePath = m_pDocument->GetPath();
-  CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath);
+  CFDF_Document* pFDFDoc =
+      m_pInterForm->ExportToFDF(wsPDFFilePath.AsWideStringC());
   if (!pFDFDoc)
     return FALSE;
 
@@ -2515,7 +2516,8 @@
 }
 
 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) {
-  CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath());
+  CFDF_Document* pFDF =
+      m_pInterForm->ExportToFDF(m_pDocument->GetPath().AsWideStringC());
   if (!pFDF)
     return FALSE;
 
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index b928aab..308163d 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -1219,11 +1219,11 @@
   else if (sTemp.Compare(L"Dec") == 0)
     nMonth = 12;
 
-  int nDay = FX_atof(wsArray[2]);
-  int nHour = FX_atof(wsArray[3]);
-  int nMin = FX_atof(wsArray[4]);
-  int nSec = FX_atof(wsArray[5]);
-  int nYear = FX_atof(wsArray[7]);
+  int nDay = FX_atof(wsArray[2].AsWideStringC());
+  int nHour = FX_atof(wsArray[3].AsWideStringC());
+  int nMin = FX_atof(wsArray[4].AsWideStringC());
+  int nSec = FX_atof(wsArray[5].AsWideStringC());
+  int nYear = FX_atof(wsArray[7].AsWideStringC());
   double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay),
                             JS_MakeTime(nHour, nMin, nSec, 0));
   if (JS_PortIsNan(dRet))
@@ -1726,7 +1726,7 @@
             CFX_WideString trimmed = pFormField->GetValue();
             trimmed.TrimRight();
             trimmed.TrimLeft();
-            dTemp = FX_atof(trimmed);
+            dTemp = FX_atof(trimmed.AsWideStringC());
           } break;
           case FIELDTYPE_PUSHBUTTON: {
             dTemp = 0.0;
@@ -1740,7 +1740,7 @@
                   CFX_WideString trimmed = pFormCtrl->GetExportValue();
                   trimmed.TrimRight();
                   trimmed.TrimLeft();
-                  dTemp = FX_atof(trimmed);
+                  dTemp = FX_atof(trimmed.AsWideStringC());
                   break;
                 }
               }
@@ -1751,7 +1751,7 @@
               CFX_WideString trimmed = pFormField->GetValue();
               trimmed.TrimRight();
               trimmed.TrimLeft();
-              dTemp = FX_atof(trimmed);
+              dTemp = FX_atof(trimmed.AsWideStringC());
             }
           } break;
           default:
diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
index 569c129..0a5f6d6 100644
--- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc
+++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
@@ -16,7 +16,7 @@
   CFX_WideString input = CFX_WideString::FromUTF8(
       reinterpret_cast<const char*>(data), static_cast<FX_STRSIZE>(size));
   CXFA_FMProgram program;
-  if (program.Init(input) || program.ParseProgram())
+  if (program.Init(input.AsWideStringC()) || program.ParseProgram())
     return 0;
 
   CFX_WideTextBuf js;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 3733852..2b403e8 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -561,7 +561,8 @@
 }
 IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos,
                                                  void* pUserData) {
-  IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext);
+  IFX_FileAccess* pAccess =
+      FX_CreateDefaultFileAccess(m_wsNext.AsWideStringC());
   m_wsNext = GetNextFile().UTF8Decode();
   pos = 0 != m_wsNext.GetLength() ? pAccess : NULL;
   return (IFX_FileAccess*)pAccess;
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index d6243ef..878cbf6 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -116,7 +116,7 @@
     return;
   }
   wsNumSymbol = FX_GetXMLContent(bsSpace.AsByteStringC(), pNumberSymbols,
-                                 "numberSymbol", wsName);
+                                 "numberSymbol", wsName.AsWideStringC());
 }
 void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
   if (!m_pElement) {
@@ -237,7 +237,8 @@
     return;
   }
   wsPattern = FX_GetXMLContent(bsSpace.AsByteStringC(), pDatePatterns,
-                               bsCategory.AsByteStringC(), wsSubCategory);
+                               bsCategory.AsByteStringC(),
+                               wsSubCategory.AsWideStringC());
 }
 static void FX_GetDateTimePattern(CXML_Element* pXmlElement,
                                   const CFX_ByteString& bsCategory,
@@ -692,7 +693,7 @@
           while (ccf < iLenf && pStr[ccf] != ')') {
             wsLCID += pStr[ccf++];
           }
-          pLocale = GetPatternLocale(wsLCID);
+          pLocale = GetPatternLocale(wsLCID.AsWideStringC());
         } else if (pStr[ccf] == '{') {
           bBrackOpen = TRUE;
           break;
@@ -751,7 +752,7 @@
           while (ccf < iLenf && pStr[ccf] != ')') {
             wsLCID += pStr[ccf++];
           }
-          pLocale = GetPatternLocale(wsLCID);
+          pLocale = GetPatternLocale(wsLCID.AsWideStringC());
         } else if (pStr[ccf] == '{') {
           bBrackOpen = TRUE;
           break;
@@ -1738,13 +1739,13 @@
         if (!FX_IsDigit(str[cc])) {
           return FALSE;
         }
-        wsValue = CFX_WideStringC(str[cc]) + wsValue;
+        wsValue = str[cc] + wsValue;
         cc--;
         ccf--;
         break;
       case 'z':
         if (FX_IsDigit(str[cc])) {
-          wsValue = CFX_WideStringC(str[cc]) + wsValue;
+          wsValue = str[cc] + wsValue;
           cc--;
         }
         ccf--;
@@ -1752,7 +1753,7 @@
       case 'Z':
         if (str[cc] != ' ') {
           if (FX_IsDigit(str[cc])) {
-            wsValue = CFX_WideStringC(str[cc]) + wsValue;
+            wsValue = str[cc] + wsValue;
             cc--;
           }
         } else {
@@ -2156,7 +2157,7 @@
     }
   }
   if (iExponent || bHavePercentSymbol) {
-    CFX_Decimal decimal = CFX_Decimal(wsValue);
+    CFX_Decimal decimal = CFX_Decimal(wsValue.AsWideStringC());
     if (iExponent) {
       decimal = decimal * CFX_Decimal(FXSYS_pow(10, (FX_FLOAT)iExponent));
     }
@@ -2166,7 +2167,7 @@
     wsValue = decimal;
   }
   if (bNeg) {
-    wsValue = CFX_WideStringC('-') + wsValue;
+    wsValue = L'-' + wsValue;
   }
   return TRUE;
 }
@@ -2228,7 +2229,7 @@
           while (ccf < iLenf && pStr[ccf] != ')') {
             wsLCID += pStr[ccf++];
           }
-          pLocale = GetPatternLocale(wsLCID);
+          pLocale = GetPatternLocale(wsLCID.AsWideStringC());
         } else if (pStr[ccf] == '{') {
           bBraceOpen = TRUE;
           break;
@@ -2926,7 +2927,7 @@
   if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') {
     wsSrcNum.Insert(0, '0');
   }
-  CFX_Decimal decimal = CFX_Decimal(wsSrcNum);
+  CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsWideStringC());
   if (dwNumStyle & FX_NUMSTYLE_Percent) {
     decimal = decimal * CFX_Decimal(100);
     wsSrcNum = decimal;
@@ -3004,10 +3005,10 @@
           if (!FX_IsDigit(str[cc])) {
             return FALSE;
           }
-          wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+          wsOutput = str[cc] + wsOutput;
           cc--;
         } else {
-          wsOutput = CFX_WideStringC(L'0') + wsOutput;
+          wsOutput = L'0' + wsOutput;
         }
         ccf--;
         break;
@@ -3017,7 +3018,7 @@
             return FALSE;
           }
           if (str[0] != '0') {
-            wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+            wsOutput = str[cc] + wsOutput;
           }
           cc--;
         }
@@ -3029,13 +3030,13 @@
             return FALSE;
           }
           if (str[0] == '0') {
-            wsOutput = CFX_WideStringC(L' ') + wsOutput;
+            wsOutput = L' ' + wsOutput;
           } else {
-            wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+            wsOutput = str[cc] + wsOutput;
           }
           cc--;
         } else {
-          wsOutput = CFX_WideStringC(L' ') + wsOutput;
+          wsOutput = L' ' + wsOutput;
         }
         ccf--;
         break;
@@ -3046,7 +3047,7 @@
           wsOutput = wsMinusSymbol + wsOutput;
           bAddNeg = TRUE;
         } else {
-          wsOutput = CFX_WideStringC(L' ') + wsOutput;
+          wsOutput = L' ' + wsOutput;
         }
         ccf--;
         break;
@@ -3148,7 +3149,7 @@
         ccf--;
         break;
       default:
-        wsOutput = CFX_WideStringC(strf[ccf]) + wsOutput;
+        wsOutput = strf[ccf] + wsOutput;
         ccf--;
     }
   }
@@ -3427,17 +3428,17 @@
     switch (strf[ccf]) {
       case '9':
         if (cc >= 0) {
-          wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+          wsOutput = str[cc] + wsOutput;
           cc--;
         } else {
-          wsOutput = CFX_WideStringC(L'0') + wsOutput;
+          wsOutput = L'0' + wsOutput;
         }
         ccf--;
         break;
       case 'z':
         if (cc >= 0) {
           if (lcNum.m_Integral != 0) {
-            wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+            wsOutput = str[cc] + wsOutput;
           }
           cc--;
         }
@@ -3446,13 +3447,13 @@
       case 'Z':
         if (cc >= 0) {
           if (lcNum.m_Integral == 0) {
-            wsOutput = CFX_WideStringC(L' ') + wsOutput;
+            wsOutput = L' ' + wsOutput;
           } else {
-            wsOutput = CFX_WideStringC(str[cc]) + wsOutput;
+            wsOutput = str[cc] + wsOutput;
           }
           cc--;
         } else {
-          wsOutput = CFX_WideStringC(L' ') + wsOutput;
+          wsOutput = L' ' + wsOutput;
         }
         ccf--;
         break;
@@ -3463,7 +3464,7 @@
           wsOutput = wsMinusSymbol + wsOutput;
           bAddNeg = TRUE;
         } else {
-          wsOutput = CFX_WideStringC(L' ') + wsOutput;
+          wsOutput = L' ' + wsOutput;
         }
         ccf--;
         break;
@@ -3565,7 +3566,7 @@
         ccf--;
         break;
       default:
-        wsOutput = CFX_WideStringC(strf[ccf]) + wsOutput;
+        wsOutput = strf[ccf] + wsOutput;
         ccf--;
     }
   }
@@ -3754,7 +3755,7 @@
   if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) {
     return FALSE;
   }
-  return FormatStrNum(wsSrcNum, wsPattern, wsOutput);
+  return FormatStrNum(wsSrcNum.AsWideStringC(), wsPattern, wsOutput);
 }
 FX_BOOL CFX_FormatString::FormatNum(FX_FLOAT fNum,
                                     const CFX_WideString& wsPattern,
@@ -4256,12 +4257,13 @@
     if (eCategory == FX_DATETIMETYPE_Date) {
       FX_DateFromCanonical(wsSrcDateTime, dt);
     } else if (eCategory == FX_DATETIMETYPE_Time) {
-      FX_TimeFromCanonical(wsSrcDateTime, dt, pLocale);
+      FX_TimeFromCanonical(wsSrcDateTime.AsWideStringC(), dt, pLocale);
     }
   } else {
     FX_DateFromCanonical(wsSrcDateTime.Left(iT), dt);
     FX_TimeFromCanonical(
-        wsSrcDateTime.Right(wsSrcDateTime.GetLength() - iT - 1), dt, pLocale);
+        wsSrcDateTime.Right(wsSrcDateTime.GetLength() - iT - 1).AsWideStringC(),
+        dt, pLocale);
   }
   return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern,
                            eCategory != FX_DATETIMETYPE_TimeDate, pLocale,
@@ -4299,7 +4301,8 @@
       return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale,
                                wsOutput);
     } else if (eCategory == FX_DATETIMETYPE_Time &&
-               FX_TimeFromCanonical(wsSrcDateTime, dt, pLocale)) {
+               FX_TimeFromCanonical(wsSrcDateTime.AsWideStringC(), dt,
+                                    pLocale)) {
       return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale,
                                wsOutput);
     }
@@ -4736,7 +4739,7 @@
 }
 
 CFX_Decimal::CFX_Decimal(const CFX_ByteStringC& strObj) {
-  *this = CFX_Decimal(CFX_WideString::FromLocal(strObj));
+  *this = CFX_Decimal(CFX_WideString::FromLocal(strObj).AsWideStringC());
 }
 
 CFX_Decimal::operator CFX_WideString() const {
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
index 9b6761b..610233e 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp
@@ -170,7 +170,7 @@
     m_pBarcodeEngine->SetTruncated(pData->GetTruncated());
   }
   int32_t errorCode = 0;
-  m_dwStatus = m_pBarcodeEngine->Encode(wsText, TRUE, errorCode)
+  m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsWideStringC(), TRUE, errorCode)
                    ? XFA_BCS_EncodeSuccess
                    : 0;
 }
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index 008936c..fb25c1e 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -423,7 +423,7 @@
     pBuffer[i] = bsReplace[i];
   }
   wsDest.ReleaseBuffer(nDestLen);
-  Replace(nWordStart, nWordCount, wsDest);
+  Replace(nWordStart, nWordCount, wsDest.AsWideStringC());
   return TRUE;
 }
 void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index f7fc301..5a5cc5e 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -822,7 +822,7 @@
     return;
   CFX_WideString text;
   pData->GetCaption(m_pInterface, text);
-  pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text);
+  pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text.AsWideStringC());
 }
 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
                                 FX_FLOAT& fWidth,
diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp
index a7310ba..d038904 100644
--- a/xfa/fxbarcode/cbc_codabar.cpp
+++ b/xfa/fxbarcode/cbc_codabar.cpp
@@ -77,7 +77,8 @@
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(filtercontents, data, outWidth, isDevice, e);
+      ->RenderResult(filtercontents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -87,18 +88,20 @@
                                   const CFX_Matrix* matirx,
                                   int32_t& e) {
   CFX_WideString renderCon =
-      ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents);
+      ((CBC_OnedCodaBarWriter*)m_pBCWriter)
+          ->encodedContents(m_renderContents.AsWideStringC());
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, renderCon, e);
+      ->RenderDeviceResult(device, matirx, renderCon.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
   CFX_WideString renderCon =
-      ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents);
+      ((CBC_OnedCodaBarWriter*)m_pBCWriter)
+          ->encodedContents(m_renderContents.AsWideStringC());
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, renderCon, e);
+      ->RenderBitmapResult(pOutBitmap, renderCon.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/cbc_code128.cpp b/xfa/fxbarcode/cbc_code128.cpp
index e585de3..2f7be93 100644
--- a/xfa/fxbarcode/cbc_code128.cpp
+++ b/xfa/fxbarcode/cbc_code128.cpp
@@ -58,15 +58,16 @@
       ((CBC_OnedCode128Writer*)m_pBCWriter)->GetType() == BC_CODE128_C) {
     content += '0';
   }
-  CFX_WideString encodeContents =
-      ((CBC_OnedCode128Writer*)m_pBCWriter)->FilterContents(content);
+  CFX_WideString encodeContents = ((CBC_OnedCode128Writer*)m_pBCWriter)
+                                      ->FilterContents(content.AsWideStringC());
   m_renderContents = encodeContents;
   CFX_ByteString byteString = encodeContents.UTF8Encode();
   uint8_t* data = static_cast<CBC_OnedCode128Writer*>(m_pBCWriter)
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(encodeContents, data, outWidth, isDevice, e);
+      ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -76,14 +77,14 @@
                                   const CFX_Matrix* matirx,
                                   int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, m_renderContents, e);
+      ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_Code128::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, m_renderContents, e);
+      ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp
index a0e3d17..a590f7e 100644
--- a/xfa/fxbarcode/cbc_code39.cpp
+++ b/xfa/fxbarcode/cbc_code39.cpp
@@ -68,7 +68,8 @@
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(renderContents, data, outWidth, isDevice, e);
+      ->RenderResult(renderContents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -77,19 +78,21 @@
 FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device,
                                  const CFX_Matrix* matirx,
                                  int32_t& e) {
-  CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter)
-                                 ->encodedContents(m_renderContents, e);
+  CFX_WideString renderCon =
+      ((CBC_OnedCode39Writer*)m_pBCWriter)
+          ->encodedContents(m_renderContents.AsWideStringC(), e);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, renderCon, e);
+      ->RenderDeviceResult(device, matirx, renderCon.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
-  CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter)
-                                 ->encodedContents(m_renderContents, e);
+  CFX_WideString renderCon =
+      ((CBC_OnedCode39Writer*)m_pBCWriter)
+          ->encodedContents(m_renderContents.AsWideStringC(), e);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, renderCon, e);
+      ->RenderBitmapResult(pOutBitmap, renderCon.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp
index e764122..149c5a6 100644
--- a/xfa/fxbarcode/cbc_ean13.cpp
+++ b/xfa/fxbarcode/cbc_ean13.cpp
@@ -74,7 +74,8 @@
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(encodeContents, data, outWidth, isDevice, e);
+      ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -84,14 +85,14 @@
                                 const CFX_Matrix* matirx,
                                 int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, m_renderContents, e);
+      ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_EAN13::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, m_renderContents, e);
+      ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp
index bc983b8..12a8213 100644
--- a/xfa/fxbarcode/cbc_ean8.cpp
+++ b/xfa/fxbarcode/cbc_ean8.cpp
@@ -73,7 +73,8 @@
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(encodeContents, data, outWidth, isDevice, e);
+      ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -83,14 +84,14 @@
                                const CFX_Matrix* matirx,
                                int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, m_renderContents, e);
+      ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_EAN8::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, m_renderContents, e);
+      ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp
index 220b8fa..79aa922 100644
--- a/xfa/fxbarcode/cbc_upca.cpp
+++ b/xfa/fxbarcode/cbc_upca.cpp
@@ -76,7 +76,8 @@
                       ->Encode(byteString, format, outWidth, outHeight, e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderResult(encodeContents, data, outWidth, isDevice, e);
+      ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice,
+                     e);
   FX_Free(data);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
@@ -86,14 +87,14 @@
                                const CFX_Matrix* matirx,
                                int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderDeviceResult(device, matirx, m_renderContents, e);
+      ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
 
 FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
   ((CBC_OneDimWriter*)m_pBCWriter)
-      ->RenderBitmapResult(pOutBitmap, m_renderContents, e);
+      ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e);
   BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
   return TRUE;
 }
diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
index 81f0339..3fbeb1c 100644
--- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp
@@ -226,6 +226,6 @@
                                          int32_t codeLength,
                                          FX_BOOL isDevice,
                                          int32_t& e) {
-  CBC_OneDimWriter::RenderResult(encodedContents(contents), code, codeLength,
-                                 isDevice, e);
+  CBC_OneDimWriter::RenderResult(encodedContents(contents).AsWideStringC(),
+                                 code, codeLength, isDevice, e);
 }
diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 31e75ca..0a69f04 100644
--- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -360,5 +360,6 @@
                                         int32_t& e) {
   CFX_WideString encodedCon = encodedContents(contents, e);
   BC_EXCEPTION_CHECK_ReturnVoid(e);
-  CBC_OneDimWriter::RenderResult(encodedCon, code, codeLength, isDevice, e);
+  CBC_OneDimWriter::RenderResult(encodedCon.AsWideStringC(), code, codeLength,
+                                 isDevice, e);
 }
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index e5ace15..28dfa86 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -167,7 +167,7 @@
   CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget;
   CFX_WideString wsType = GetDataAcc()->GetBarcodeType();
   XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo =
-      XFA_GetBarcodeTypeByName(wsType);
+      XFA_GetBarcodeTypeByName(wsType.AsWideStringC());
   pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType);
   CXFA_WidgetAcc* pAcc = GetDataAcc();
   int32_t intVal;
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 44ae142..645b8c8 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -44,7 +44,7 @@
   m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
   int32_t iItems = wsLabelArray.GetSize();
   for (int32_t i = 0; i < iItems; i++) {
-    pListBox->AddString(wsLabelArray[i]);
+    pListBox->AddString(wsLabelArray[i].AsWideStringC());
   }
   uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus;
   if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
@@ -166,7 +166,7 @@
 void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel,
                                 int32_t nIndex) {
   CFX_WideString wsTemp(wsLabel);
-  ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp);
+  ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsWideStringC());
   m_pNormalWidget->Update();
   AddInvalidateRect();
 }
@@ -240,7 +240,7 @@
   m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE);
   int32_t iItems = wsLabelArray.GetSize();
   for (int32_t i = 0; i < iItems; i++) {
-    pComboBox->AddString(wsLabelArray[i]);
+    pComboBox->AddString(wsLabelArray[i].AsWideStringC());
   }
   CFX_Int32Array iSelArray;
   m_pDataAcc->GetSelectedItems(iSelArray);
@@ -250,7 +250,7 @@
   } else {
     CFX_WideString wsText;
     m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
-    pComboBox->SetEditText(wsText);
+    pComboBox->SetEditText(wsText.AsWideStringC());
   }
   UpdateWidgetProperty();
   m_pNormalWidget->UnlockUpdate();
@@ -382,7 +382,7 @@
     CFX_WideString wsText;
     ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1);
     m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw);
-    ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText);
+    ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC());
   }
   m_pNormalWidget->Update();
   return TRUE;
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 5e88135..c82fd53 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -162,7 +162,8 @@
     }
     CFX_WideString wsTitle;
     pAppProvider->LoadString(XFA_IDS_AppName, wsTitle);
-    pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
+    pAppProvider->MsgBox(wsMsg.AsWideStringC(), wsTitle.AsWideStringC(),
+                         XFA_MBICON_Status, XFA_MB_OK);
   }
   m_arrNullTestMsg.RemoveAll();
 }
@@ -515,8 +516,8 @@
     wsExpression = L"$form." + wsName;
   }
   XFA_RESOLVENODE_RS resoveNodeRS;
-  int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression,
-                                                resoveNodeRS, dwStyle);
+  int32_t iRet = pScriptContext->ResolveObjects(
+      refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwStyle);
   if (iRet < 1) {
     return NULL;
   }
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index a0f64e9..229ed43 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -731,7 +731,8 @@
           wsMessage += wsWarning;
           CFX_WideString wsTitle;
           pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle);
-          pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning,
+          pAppProvider->MsgBox(wsMessage.AsWideStringC(),
+                               wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                XFA_MB_OK);
         }
       }
@@ -763,7 +764,8 @@
           wsMessage += wsWarning;
           CFX_WideString wsTitle;
           pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle);
-          if (pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning,
+          if (pAppProvider->MsgBox(wsMessage.AsWideStringC(),
+                                   wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                    XFA_MB_YesNo) == XFA_IDYes) {
             pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
             return 1;
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index ce69b12..d419fbd 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -108,7 +108,8 @@
   CFX_WideString wsFilter;
   pAppProvider->LoadString(XFA_IDS_ImageFilter, wsFilter);
   CFX_WideStringArray wsPathArray;
-  pAppProvider->ShowFileDialog(wsTitle, wsFilter, wsPathArray);
+  pAppProvider->ShowFileDialog(wsTitle.AsWideStringC(),
+                               wsFilter.AsWideStringC(), wsPathArray);
   int32_t iSize = wsPathArray.GetSize();
   if (iSize < 1) {
     return TRUE;
@@ -147,7 +148,8 @@
     m_pDataAcc->SetImageEditImage(NULL);
     pFileRead->Release();
   }
-  m_pDataAcc->SetImageEdit(wsContentType, CFX_WideStringC(), wsImage);
+  m_pDataAcc->SetImageEdit(wsContentType.AsWideStringC(), CFX_WideStringC(),
+                           wsImage.AsWideStringC());
   m_pDataAcc->LoadImageEditImage();
   AddInvalidateRect();
   m_pDocView->SetChangeMark();
diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp
index e22ddc0..21eb855 100644
--- a/xfa/fxfa/app/xfa_ffpageview.cpp
+++ b/xfa/fxfa/app/xfa_ffpageview.cpp
@@ -270,7 +270,7 @@
     if (pTraverse) {
       CFX_WideString wsTraverseWidgetName;
       if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) {
-        return FindWidgetByName(wsTraverseWidgetName, pWidget);
+        return FindWidgetByName(wsTraverseWidgetName.AsWideStringC(), pWidget);
       }
     }
   }
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index fa53016..de93c03 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -201,7 +201,8 @@
       pAcc->GetNode()->GetSOMExpression(wsSomField);
       wsMessage.Format(wsError, (const FX_WCHAR*)wsText,
                        (const FX_WCHAR*)wsSomField);
-      pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
+      pAppProvider->MsgBox(wsMessage.AsWideStringC(), wsTitle.AsWideStringC(),
+                           XFA_MBICON_Error, XFA_MB_OK);
     }
   }
 }
@@ -593,7 +594,7 @@
   m_pNormalWidget->LockUpdate();
   CFX_WideString wsText;
   m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
-  pWidget->SetEditText(wsText);
+  pWidget->SetEditText(wsText.AsWideStringC());
   if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
     switch (value.GetChildValueClassID()) {
       case XFA_ELEMENT_Date: {
@@ -693,7 +694,7 @@
   }
   CFX_WideString wsText;
   m_pDataAcc->GetValue(wsText, eType);
-  ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText);
+  ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC());
   if (IsFocused() && !wsText.IsEmpty()) {
     CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
     CFX_Unitime date = lcValue.GetDate();
@@ -776,7 +777,7 @@
   date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
                       XFA_VALUEPICTURE_Edit);
   CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget;
-  pDateTime->SetEditText(wsDate);
+  pDateTime->SetEditText(wsDate.AsWideStringC());
   pDateTime->Update();
   GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL);
   CXFA_EventParam eParam;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 241bae0..3a238ad 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -944,7 +944,7 @@
   out[j] = '\0';
   return out;
 }
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType) {
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) {
   CFX_WideString wsContentType(wsType);
   wsContentType.MakeLower();
   if (wsContentType == FX_WSTRC(L"image/jpg")) {
@@ -1003,7 +1003,7 @@
     if (wsURL.Left(7) != FX_WSTRC(L"http://") &&
         wsURL.Left(6) != FX_WSTRC(L"ftp://")) {
       CFX_DIBitmap* pBitmap =
-          pDoc->GetPDFNamedImage(wsURL, iImageXDpi, iImageYDpi);
+          pDoc->GetPDFNamedImage(wsURL.AsWideStringC(), iImageXDpi, iImageYDpi);
       if (pBitmap) {
         bNameImage = TRUE;
         return pBitmap;
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 271f926..fb2b0c3 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -229,7 +229,8 @@
         image.GetContentType(wsContentType);
         image.GetHref(wsHref);
       }
-      SetImageEdit(wsContentType, wsHref, wsValue);
+      SetImageEdit(wsContentType.AsWideStringC(), wsHref.AsWideStringC(),
+                   wsValue.AsWideStringC());
     } break;
     case XFA_ELEMENT_ExclGroup: {
       CXFA_Node* pNextChild = m_pNode->GetNodeItem(
@@ -411,11 +412,13 @@
           GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag);
         }
         if (bVersionFlag) {
-          pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
+          pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(),
+                               wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                XFA_MB_OK);
           return;
         }
-        if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning,
+        if (pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(),
+                                 wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                  XFA_MB_YesNo) == XFA_IDYes) {
           GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
         }
@@ -423,7 +426,9 @@
         if (wsScriptMsg.IsEmpty()) {
           GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag);
         }
-        pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
+        pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(),
+                             wsTitle.AsWideStringC(), XFA_MBICON_Error,
+                             XFA_MB_OK);
       }
     }
   }
@@ -456,7 +461,9 @@
         if (wsFormatMsg.IsEmpty()) {
           GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag);
         }
-        pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK);
+        pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(),
+                             wsTitle.AsWideStringC(), XFA_MBICON_Error,
+                             XFA_MB_OK);
         return XFA_EVENTERROR_Success;
       }
       if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
@@ -466,11 +473,13 @@
         GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag);
       }
       if (bVersionFlag) {
-        pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
+        pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(),
+                             wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                              XFA_MB_OK);
         return XFA_EVENTERROR_Success;
       }
-      if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning,
+      if (pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(),
+                               wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                XFA_MB_YesNo) == XFA_IDYes) {
         GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
       }
@@ -526,7 +535,8 @@
         pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError);
         wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName);
       }
-      pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK);
+      pAppProvider->MsgBox(wsNullMsg.AsWideStringC(), wsTitle.AsWideStringC(),
+                           XFA_MBICON_Status, XFA_MB_OK);
       return XFA_EVENTERROR_Error;
     }
     case XFA_ATTRIBUTEENUM_Warning: {
@@ -540,7 +550,8 @@
         wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName,
                          (const FX_WCHAR*)wsCaptionName);
       }
-      if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning,
+      if (pAppProvider->MsgBox(wsNullMsg.AsWideStringC(),
+                               wsTitle.AsWideStringC(), XFA_MBICON_Warning,
                                XFA_MB_YesNo) == XFA_IDYes) {
         GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
       }
@@ -671,8 +682,9 @@
   }
   FXJSE_HVALUE hRetValue = FXJSE_Value_Create(pContext->GetRuntime());
   ++m_nRecursionDepth;
-  FX_BOOL bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
-                                     wsExpression, hRetValue, m_pNode);
+  FX_BOOL bRet =
+      pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
+                          wsExpression.AsWideStringC(), hRetValue, m_pNode);
   --m_nRecursionDepth;
   int32_t iRet = XFA_EVENTERROR_Error;
   if (bRet) {
@@ -1700,11 +1712,12 @@
     CXFA_Node* pIDNode = NULL;
     CXFA_WidgetAcc* pEmbAcc = NULL;
     if (pParent) {
-      pIDNode = pDocument->GetNodeByID(pParent, wsAttr);
+      pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsWideStringC());
     }
     if (!pIDNode) {
       pIDNode = pDocument->GetNodeByID(
-          ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr);
+          ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
+          wsAttr.AsWideStringC());
     }
     if (pIDNode) {
       pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData();
diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp
index 1b87f95..8ffb7ce 100644
--- a/xfa/fxfa/app/xfa_fontmgr.cpp
+++ b/xfa/fxfa/app/xfa_fontmgr.cpp
@@ -1765,7 +1765,8 @@
   IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
   IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage);
   if (!pFont) {
-    const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName);
+    const XFA_FONTINFO* pCurFont =
+        XFA_GetFontINFOByFontName(wsFontName.AsWideStringC());
     if (pCurFont && pCurFont->pReplaceFont) {
       uint32_t dwStyle = 0;
       if (dwFontStyles & FX_FONTSTYLE_Bold) {
@@ -2029,7 +2030,8 @@
   CPDF_Font* pPDFFont = NULL;
   IFX_Font* pFont = NULL;
   if (pMgr) {
-    pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont);
+    pFont =
+        pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, &pPDFFont);
     if (pFont)
       return pFont;
   }
@@ -2038,7 +2040,8 @@
   }
   if (!pFont && pMgr) {
     pPDFFont = NULL;
-    pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont, FALSE);
+    pFont = pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles,
+                          &pPDFFont, FALSE);
     if (pFont)
       return pFont;
   }
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index 4cbdfd4..cd32363 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -317,29 +317,26 @@
     tagProvider.m_bContent = TRUE;
   }
 }
+
 int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const {
-  int32_t iAlign = XFA_ATTRIBUTEENUM_Top;
   CXFA_Para para = pTextProvider->GetParaNode();
-  if (para) {
-    iAlign = para.GetVerticalAlign();
-  }
-  return iAlign;
+  return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top;
 }
+
 FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const {
   CFX_WideString wsValue;
-  if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) {
-    CXFA_Measurement ms(wsValue);
-    return ms.ToUnit(XFA_UNIT_Pt);
-  }
+  if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue))
+    return CXFA_Measurement(wsValue.AsWideStringC()).ToUnit(XFA_UNIT_Pt);
   return 36;
 }
+
 int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const {
   CFX_WideString wsValue;
-  if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) {
+  if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue))
     return wsValue.GetInteger();
-  }
   return 0;
 }
+
 FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const {
   CFX_WideString wsValue;
   if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) {
diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h
index 9b92e17..d92a2f4 100644
--- a/xfa/fxfa/app/xfa_textlayout.h
+++ b/xfa/fxfa/app/xfa_textlayout.h
@@ -25,7 +25,9 @@
  public:
   CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {}
   virtual ~CXFA_CSSTagProvider();
-  virtual CFX_WideStringC GetTagName() { return m_wsTagName; }
+
+  // Note: |this| must outlive the use of GetTagName()'s result.
+  virtual CFX_WideStringC GetTagName() { return m_wsTagName.AsWideStringC(); }
   virtual FX_POSITION GetFirstAttribute() {
     return m_Attributes.GetStartPosition();
   }
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index c016e20..518d233 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -1589,7 +1589,8 @@
         pLocale = widgetData.GetLocal();
       } else {
         pLocale = pMgr->GetLocaleByName(
-            CFX_WideString::FromUTF8(localString, localString.GetLength()));
+            CFX_WideString::FromUTF8(localString, localString.GetLength())
+                .AsWideStringC());
       }
       CFX_WideString wsFormat;
       if (formatString.IsEmpty()) {
@@ -2039,7 +2040,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()));
+        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return FALSE;
@@ -2077,7 +2079,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()));
+        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return FALSE;
@@ -2118,7 +2121,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()));
+        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return FALSE;
@@ -2158,7 +2162,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()));
+        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return FALSE;
@@ -2200,7 +2205,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()));
+        CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return FALSE;
@@ -2383,7 +2389,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength()));
+        CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return;
@@ -2438,7 +2445,8 @@
     pLocale = widgetData.GetLocal();
   } else {
     pLocale = pMgr->GetLocaleByName(
-        CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength()));
+        CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())
+            .AsWideStringC());
   }
   if (!pLocale) {
     return;
@@ -3257,8 +3265,9 @@
       CFX_WideTextBuf wsJavaScriptBuf;
       CFX_WideString javaScript;
       CFX_WideString wsError;
-      XFA_FM2JS_Translate(CFX_WideString::FromUTF8(
-                              utf8ScriptString, utf8ScriptString.GetLength()),
+      XFA_FM2JS_Translate(CFX_WideString::FromUTF8(utf8ScriptString,
+                                                   utf8ScriptString.GetLength())
+                              .AsWideStringC(),
                           wsJavaScriptBuf, wsError);
       FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime);
       FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime);
@@ -5481,7 +5490,8 @@
     CFX_ByteString urlString;
     HValueToUTF8String(argOne, urlString);
     IFX_FileRead* pFile = pAppProvider->DownloadURL(
-        CFX_WideString::FromUTF8(urlString, urlString.GetLength()));
+        CFX_WideString::FromUTF8(urlString, urlString.GetLength())
+            .AsWideStringC());
     if (pFile) {
       int32_t size = pFile->GetSize();
       uint8_t* pData = FX_Alloc(uint8_t, size);
@@ -5541,11 +5551,14 @@
     }
     CFX_WideString decodedResponse;
     FX_BOOL bFlags = pAppProvider->PostRequestURL(
-        CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()),
-        CFX_WideString::FromUTF8(bsData, bsData.GetLength()),
-        CFX_WideString::FromUTF8(bsContentType, bsContentType.GetLength()),
-        CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength()),
-        CFX_WideString::FromUTF8(bsHeader, bsHeader.GetLength()),
+        CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()).AsWideStringC(),
+        CFX_WideString::FromUTF8(bsData, bsData.GetLength()).AsWideStringC(),
+        CFX_WideString::FromUTF8(bsContentType, bsContentType.GetLength())
+            .AsWideStringC(),
+        CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength())
+            .AsWideStringC(),
+        CFX_WideString::FromUTF8(bsHeader, bsHeader.GetLength())
+            .AsWideStringC(),
         decodedResponse);
     FXJSE_Value_Release(argOne);
     FXJSE_Value_Release(argTwo);
@@ -5602,9 +5615,10 @@
       HValueToUTF8String(argThree, bsEncode);
     }
     FX_BOOL bFlags = pAppProvider->PutRequestURL(
-        CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()),
-        CFX_WideString::FromUTF8(bsData, bsData.GetLength()),
-        CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength()));
+        CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()).AsWideStringC(),
+        CFX_WideString::FromUTF8(bsData, bsData.GetLength()).AsWideStringC(),
+        CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength())
+            .AsWideStringC());
     FXJSE_Value_Release(argOne);
     FXJSE_Value_Release(argTwo);
     if (argc > 2) {
@@ -6410,7 +6424,8 @@
           CFX_WideString::FromUTF8(argString, argString.GetLength());
       CFX_WideTextBuf wsJavaScriptBuf;
       CFX_WideString wsError;
-      XFA_FM2JS_Translate(scriptString, wsJavaScriptBuf, wsError);
+      XFA_FM2JS_Translate(scriptString.AsWideStringC(), wsJavaScriptBuf,
+                          wsError);
       if (wsError.IsEmpty()) {
         CFX_WideString javaScript = wsJavaScriptBuf.GetWideString();
         FXJSE_Value_SetUTF8String(
@@ -6879,7 +6894,8 @@
   int32_t iRet = pScriptContext->ResolveObjects(
       pScriptContext->GetThisObject(),
       CFX_WideString::FromUTF8(szAccessorName.c_str(),
-                               szAccessorName.GetLength()),
+                               szAccessorName.GetLength())
+          .AsWideStringC(),
       resoveNodeRS, dwFlags);
   if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
     FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap(
@@ -6936,8 +6952,8 @@
     pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL);
     dFlags = XFA_RESOLVENODE_AnyChild;
   }
-  iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression, resoveNodeRS,
-                                        dFlags);
+  iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsWideStringC(),
+                                        resoveNodeRS, dFlags);
   return iRet;
 }
 void CXFA_FM2JSContext::ParseResolveResult(
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index a5f021a..a28b499 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -131,7 +131,8 @@
         CFDE_XMLElement* pXMLDataElement =
             static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
         FXSYS_assert(pXMLDataElement);
-        pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
+        pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                        wsFormatedValue);
         pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
         pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
         if (!wsHref.IsEmpty()) {
@@ -160,7 +161,8 @@
                 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup"));
           }
         } else if (!wsValue.IsEmpty()) {
-          pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
+          pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                          wsFormatedValue);
           pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
         }
         break;
@@ -169,7 +171,8 @@
         if (wsValue.IsEmpty()) {
           break;
         }
-        pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
+        pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                        wsFormatedValue);
         pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
         break;
       case XFA_ELEMENT_ExclGroup: {
@@ -239,7 +242,8 @@
         CFX_WideString wsOutput;
         pWidgetData->NormalizeNumStr(wsValue, wsOutput);
         wsValue = wsOutput;
-        pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
+        pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                        wsFormatedValue);
         pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
         CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value);
         XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue,
@@ -250,7 +254,8 @@
         if (wsValue.IsEmpty()) {
           break;
         }
-        pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue);
+        pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                        wsFormatedValue);
         pDataNode->SetAttributeValue(wsValue, wsFormatedValue);
         break;
     }
@@ -258,7 +263,8 @@
     CFX_WideString wsXMLValue;
     pDataNode->TryContent(wsXMLValue);
     CFX_WideString wsNormailizeValue;
-    pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormailizeValue);
+    pWidgetData->GetNormalizeDataValue(wsXMLValue.AsWideStringC(),
+                                       wsNormailizeValue);
     pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue);
     switch (eUIType) {
       case XFA_ELEMENT_ImageEdit: {
@@ -312,8 +318,8 @@
             defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text);
         break;
       case XFA_ELEMENT_ExclGroup: {
-        pWidgetData->SetSelectedMemberByValue(wsNormailizeValue, bNotify, FALSE,
-                                              FALSE);
+        pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsWideStringC(),
+                                              bNotify, FALSE, FALSE);
       } break;
       case XFA_ELEMENT_DateTimeEdit:
         XFA_DataMerge_FormValueNode_SetChildContent(
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index 2ae82e3..39590f6 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -297,7 +297,7 @@
         buf << FX_WSTRC(L" xmlns=\"\"\n>");
         for (int32_t i = 0; i < wsSelTextArray.GetSize(); i++) {
           buf << FX_WSTRC(L"<value\n>");
-          buf << XFA_ExportEncodeContent(wsSelTextArray[i]);
+          buf << XFA_ExportEncodeContent(wsSelTextArray[i].AsWideStringC());
           buf << FX_WSTRC(L"</value\n>");
         }
         buf << FX_WSTRC(L"</");
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index eb67b0f..d69bf25 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -1388,7 +1388,7 @@
         wsWidth = widths[i];
         wsWidth.TrimLeft(L' ');
         if (!wsWidth.IsEmpty()) {
-          CXFA_Measurement measure(wsWidth);
+          CXFA_Measurement measure(wsWidth.AsWideStringC());
           m_rgSpecifiedColumnWidths.Add(measure.ToUnit(XFA_UNIT_Pt));
         }
       }
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 888cf4f..b12f4ce 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -297,7 +297,7 @@
     if (wsTargetExpr.GetAt(0) == '#') {
       CXFA_Node* pNode = pDocument->GetNodeByID(
           ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
-          wsTargetExpr.Mid(1));
+          wsTargetExpr.Mid(1).AsWideStringC());
       if (pNode) {
         return pNode;
       }
@@ -309,7 +309,7 @@
       }
       XFA_RESOLVENODE_RS rs;
       int32_t iCount = pDocument->GetScriptContext()->ResolveObjects(
-          pPageSetRoot, wsProcessedTarget, rs,
+          pPageSetRoot, wsProcessedTarget.AsWideStringC(), rs,
           XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
               XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings |
               XFA_RESOLVENODE_Parent);
diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp
index 141e295..c77dc26 100644
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ b/xfa/fxfa/parser/xfa_locale.cpp
@@ -79,7 +79,7 @@
   }
   GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols,
                                        bsSymbols.GetLength() - 1),
-             wsName, wsNumSymbol);
+             wsName.AsWideStringC(), wsNumSymbol);
 }
 void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
   if (!m_pLocaleData) {
@@ -162,7 +162,7 @@
       wsName = L"long";
       break;
   }
-  GetPattern(pElement, "datePattern", wsName, wsPattern);
+  GetPattern(pElement, "datePattern", wsName.AsWideStringC(), wsPattern);
 }
 void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
                                     CFX_WideString& wsPattern) const {
@@ -186,7 +186,7 @@
       wsName = L"long";
       break;
   }
-  GetPattern(pElement, "timePattern", wsName, wsPattern);
+  GetPattern(pElement, "timePattern", wsName.AsWideStringC(), wsPattern);
 }
 void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
                                    CFX_WideString& wsPattern) const {
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp
index 7ccf228..0c09830 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -1132,7 +1132,7 @@
       pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling);
     }
   }
-  m_pDefLocale = GetLocaleByName(wsDeflcid);
+  m_pDefLocale = GetLocaleByName(wsDeflcid.AsWideStringC());
 }
 CXFA_LocaleMgr::~CXFA_LocaleMgr() {
   int32_t iCount = m_LocaleArray.GetSize();
@@ -1266,7 +1266,7 @@
     }
     m_dwLocaleFlags |= 0x01;
   }
-  return m_wsConfigLocale;
+  return m_wsConfigLocale.AsWideStringC();
 }
 static CXFA_TimeZoneProvider* g_pProvider = NULL;
 
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index 3c85622..99738c6 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -369,7 +369,8 @@
   if (m_bValid && m_dwType == XFA_VT_TIME) {
     CFX_Unitime dt(0);
     FXSYS_assert(m_pLocaleMgr);
-    FX_TimeFromCanonical(m_wsValue, dt, m_pLocaleMgr->GetDefLocale());
+    FX_TimeFromCanonical(m_wsValue.AsWideStringC(), dt,
+                         m_pLocaleMgr->GetDefLocale());
     return dt;
   }
   return CFX_Unitime();
@@ -380,8 +381,9 @@
     CFX_Unitime dt;
     FX_DateFromCanonical(m_wsValue.Left(index), dt);
     FXSYS_assert(m_pLocaleMgr);
-    FX_TimeFromCanonical(m_wsValue.Right(m_wsValue.GetLength() - index - 1), dt,
-                         m_pLocaleMgr->GetDefLocale());
+    FX_TimeFromCanonical(
+        m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsWideStringC(), dt,
+        m_pLocaleMgr->GetDefLocale());
     return dt;
   }
   return CFX_Unitime();
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 4c3ecd2..1dd5265 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -648,8 +648,8 @@
                     XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
                     XFA_RESOLVENODE_Siblings;
   XFA_RESOLVENODE_RS resoveNodeRS;
-  int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression,
-                                                resoveNodeRS, dwFlag);
+  int32_t iRet = pScriptContext->ResolveObjects(
+      refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag);
   if (iRet < 1) {
     return FXJSE_Value_SetNull(pArguments->GetReturnValue());
   }
@@ -708,7 +708,8 @@
   if (refNode == NULL) {
     refNode = this;
   }
-  pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag);
+  pScriptContext->ResolveObjects(refNode, wsExpression.AsWideStringC(),
+                                 resoveNodeRS, dwFlag);
   CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
   if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
     for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
@@ -878,7 +879,7 @@
   wsExpression =
       CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
   CFX_WideString wsValue;
-  GetAttribute(wsExpression, wsValue);
+  GetAttribute(wsExpression.AsWideStringC(), wsValue);
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
   if (hValue) {
     FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
@@ -900,7 +901,8 @@
   if (iLength >= 2) {
     iValue = pArguments->GetInt32(1);
   }
-  const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression);
+  const XFA_ELEMENTINFO* pElementInfo =
+      XFA_GetElementByName(wsExpression.AsWideStringC());
   CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName);
   FXJSE_Value_Set(pArguments->GetReturnValue(),
                   m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
@@ -929,13 +931,14 @@
   }
   FX_BOOL bHas = FALSE;
   const XFA_ATTRIBUTEINFO* pAttributeInfo =
-      XFA_GetAttributeByName(wsExpression);
+      XFA_GetAttributeByName(wsExpression.AsWideStringC());
   CFX_WideString wsValue;
   if (pAttributeInfo) {
     bHas = HasAttribute(pAttributeInfo->eName);
   }
   if (!bHas) {
-    const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression);
+    const XFA_ELEMENTINFO* pElementInfo =
+        XFA_GetElementByName(wsExpression.AsWideStringC());
     bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL);
   }
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
@@ -1158,7 +1161,8 @@
   wsAttributeValue =
       CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength());
   wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength());
-  SetAttribute(wsAttribute, wsAttributeValue, TRUE);
+  SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(),
+               TRUE);
 }
 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
   int32_t iLength = pArguments->GetLength();
@@ -1483,7 +1487,7 @@
     FXJSE_Value_ToUTF8String(hValue, szValue);
     CFX_WideString wsValue =
         CFX_WideString::FromUTF8(szValue, szValue.GetLength());
-    SetAttribute(eAttribute, wsValue, TRUE);
+    SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE);
     if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
       CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
       CXFA_Node* pTemplateNode =
@@ -1508,12 +1512,12 @@
                           XFA_RESOLVENODE_Siblings;
         XFA_RESOLVENODE_RS resoveNodeRS;
         int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
-            pProtoRoot, wsSOM, resoveNodeRS, dwFlag);
+            pProtoRoot, wsSOM.AsWideStringC(), resoveNodeRS, dwFlag);
         if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
           pProtoNode = resoveNodeRS.nodes[0]->AsNode();
         }
       } else if (!wsID.IsEmpty()) {
-        pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID);
+        pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsWideStringC());
       }
       if (pProtoNode) {
         CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -1701,7 +1705,8 @@
       pContainerWidgetData = GetContainerWidgetData();
     }
     if (pContainerWidgetData) {
-      pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
+      pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(),
+                                               wsFormatValue);
     }
     SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
   } else {
@@ -1712,7 +1717,7 @@
     } else if (classID == XFA_ELEMENT_Integer) {
       FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content));
     } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) {
-      CFX_Decimal decimal(content);
+      CFX_Decimal decimal(content.AsWideStringC());
       FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
     } else {
       FXJSE_Value_SetUTF8String(
@@ -1748,7 +1753,8 @@
     CFX_WideString wsFormatValue(wsNewValue);
     CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
     if (pContainerWidgetData) {
-      pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
+      pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(),
+                                               wsFormatValue);
     }
     SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
   } else {
@@ -1891,7 +1897,7 @@
     wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength());
     for (int32_t i = 0; i < iSize; ++i) {
       CXFA_Edge edge = border.GetEdge(i);
-      CXFA_Measurement thickness(wsThickness);
+      CXFA_Measurement thickness(wsThickness.AsWideStringC());
       edge.SetMSThickness(thickness);
     }
   } else {
@@ -2008,7 +2014,8 @@
     CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
     CFX_WideString wsFormatText(wsNewText);
     if (pContainerWidgetData) {
-      pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText);
+      pContainerWidgetData->GetFormatDataValue(wsNewText.AsWideStringC(),
+                                               wsFormatText);
     }
     SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE);
   } else {
@@ -2027,7 +2034,7 @@
               hValue,
               FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
         } else {
-          CFX_Decimal decimal(content);
+          CFX_Decimal decimal(content.AsWideStringC());
           FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
         }
       } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) {
@@ -2035,7 +2042,7 @@
       } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) {
         FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE);
       } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) {
-        CFX_Decimal decimal(content);
+        CFX_Decimal decimal(content.AsWideStringC());
         FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
       } else {
         FXJSE_Value_SetUTF8String(
@@ -2183,7 +2190,8 @@
   if (argc == 1) {
     CFX_ByteString eventString = pArguments->GetUTF8String(0);
     int32_t iRet = execSingleEventByName(
-        CFX_WideString::FromUTF8(eventString, eventString.GetLength()),
+        CFX_WideString::FromUTF8(eventString, eventString.GetLength())
+            .AsWideStringC(),
         XFA_ELEMENT_Field);
     if (eventString == "validate") {
       FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
@@ -2263,7 +2271,7 @@
   CFX_WideString wsValue =
       CFX_WideString::FromUTF8(bsValue, bsValue.GetLength());
   CFX_WideString wsBoundValue;
-  pWidgetData->GetItemValue(wsValue, wsBoundValue);
+  pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue);
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
   if (hValue) {
     FXJSE_Value_SetUTF8String(hValue,
@@ -2407,7 +2415,8 @@
     CFX_ByteString bsValue;
     FXJSE_Value_ToUTF8String(hValue, bsValue);
     pWidgetData->SetSelectedMemberByValue(
-        CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE);
+        CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC(),
+        TRUE, TRUE);
   } else {
     CFX_WideString wsValue = GetScriptContent(TRUE);
     XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
@@ -2426,7 +2435,8 @@
   if (argc == 1) {
     CFX_ByteString eventString = pArguments->GetUTF8String(0);
     execSingleEventByName(
-        CFX_WideString::FromUTF8(eventString, eventString.GetLength()),
+        CFX_WideString::FromUTF8(eventString, eventString.GetLength())
+            .AsWideStringC(),
         XFA_ELEMENT_ExclGroup);
   } else {
     ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
@@ -2446,7 +2456,8 @@
         CFX_ByteString szName;
         szName = pArguments->GetUTF8String(0);
         pReturnNode = pWidgetData->SetSelectedMember(
-            CFX_WideString::FromUTF8(szName, szName.GetLength()));
+            CFX_WideString::FromUTF8(szName, szName.GetLength())
+                .AsWideStringC());
       }
       if (pReturnNode) {
         FXJSE_Value_Set(
@@ -2622,7 +2633,8 @@
   if (argc == 1) {
     CFX_ByteString eventString = pArguments->GetUTF8String(0);
     execSingleEventByName(
-        CFX_WideString::FromUTF8(eventString, eventString.GetLength()),
+        CFX_WideString::FromUTF8(eventString, eventString.GetLength())
+            .AsWideStringC(),
         XFA_ELEMENT_Subform);
   } else {
     ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
@@ -2738,7 +2750,8 @@
             CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength());
       }
     }
-    const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(strTagName);
+    const XFA_ELEMENTINFO* pElement =
+        XFA_GetElementByName(strTagName.AsWideStringC());
     CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName);
     if (!pNewNode) {
       FXJSE_Value_SetNull(pArguments->GetReturnValue());
@@ -2746,7 +2759,8 @@
       if (!strName.IsEmpty()) {
         if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
                                       XFA_XDPPACKET_UNKNOWN)) {
-          pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName, TRUE);
+          pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsWideStringC(),
+                                 TRUE);
           if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
             pNewNode->CreateXMLMappingNode();
           }
@@ -3504,7 +3518,8 @@
     CFX_ByteString bsChecksum;
     FXJSE_Value_ToUTF8String(hValue, bsChecksum);
     SetAttribute(XFA_ATTRIBUTE_Checksum,
-                 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength()));
+                 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())
+                     .AsWideStringC());
   } else {
     CFX_WideString wsChecksum;
     GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE);
@@ -3964,7 +3979,7 @@
     CFX_WideString* pClone = new CFX_WideString(wsValue);
     SetUserData(pKey, pClone, &deleteWideStringCallBack);
   } else {
-    SetMapModuleString(pKey, wsValue);
+    SetMapModuleString(pKey, wsValue.AsWideStringC());
     if (eAttr == XFA_ATTRIBUTE_Name)
       UpdateNameHash();
   }
@@ -4321,7 +4336,8 @@
         GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
         if (wsContentType == FX_WSTRC(L"text/html")) {
           wsContentType = FX_WSTRC(L"");
-          SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType);
+          SetAttribute(XFA_ATTRIBUTE_ContentType,
+                       wsContentType.AsWideStringC());
         }
       }
       CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -5233,7 +5249,7 @@
     CFX_WideString wsFormatValue(wsValue);
     CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
     if (pWidgetData) {
-      pWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
+      pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), wsFormatValue);
     }
     pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE);
   }
@@ -5332,8 +5348,8 @@
   int32_t argc = pArguments->GetLength();
   if (argc == 1) {
     CFX_ByteString szName = pArguments->GetUTF8String(0);
-    CXFA_Node* pNode =
-        NamedItem(CFX_WideString::FromUTF8(szName, szName.GetLength()));
+    CXFA_Node* pNode = NamedItem(
+        CFX_WideString::FromUTF8(szName, szName.GetLength()).AsWideStringC());
     if (!pNode) {
       return;
     }
diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp
index 94657c6..22f8fc2 100644
--- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp
+++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp
@@ -477,7 +477,7 @@
   if (m_bDefValue) {
     return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref);
   }
-  return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref);
+  return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsWideStringC());
 }
 FX_BOOL CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) {
   if (m_bDefValue) {
@@ -510,7 +510,8 @@
 FX_BOOL CXFA_Validate::SetTestValue(int32_t iType,
                                     CFX_WideString& wsValue,
                                     XFA_ATTRIBUTEENUM eName) {
-  const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByName(wsValue);
+  const XFA_ATTRIBUTEENUMINFO* pInfo =
+      XFA_GetAttributeEnumByName(wsValue.AsWideStringC());
   if (pInfo) {
     eName = pInfo->eName;
   }
@@ -1590,7 +1591,7 @@
       if (iSel < 0) {
         CFX_WideString wsSaveText = wsSaveTextArray[nIndex];
         CFX_WideString wsFormatText(wsSaveText);
-        GetFormatDataValue(wsSaveText, wsFormatText);
+        GetFormatDataValue(wsSaveText.AsWideStringC(), wsFormatText);
         m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify,
                             bSyncData);
       }
@@ -1619,7 +1620,7 @@
   }
   CFX_WideString wsFormat(wsValue);
   if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) {
-    GetFormatDataValue(wsValue, wsFormat);
+    GetFormatDataValue(wsValue.AsWideStringC(), wsFormat);
   }
   m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData);
 }
@@ -1656,19 +1657,19 @@
   if (iCount < 1) {
     CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items);
     m_pNode->InsertChild(-1, pItems);
-    InsertListTextItem(pItems, wsLabel, nIndex);
+    InsertListTextItem(pItems, wsLabel.AsWideStringC(), nIndex);
     CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items);
     m_pNode->InsertChild(-1, pSaveItems);
     pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE);
-    InsertListTextItem(pSaveItems, wsNewValue, nIndex);
+    InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex);
   } else if (iCount > 1) {
     for (int32_t i = 0; i < 2; i++) {
       CXFA_Node* pNode = listitems[i];
       FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save);
       if (bHasSave) {
-        InsertListTextItem(pNode, wsNewValue, nIndex);
+        InsertListTextItem(pNode, wsNewValue.AsWideStringC(), nIndex);
       } else {
-        InsertListTextItem(pNode, wsLabel, nIndex);
+        InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex);
       }
     }
   } else {
@@ -1685,12 +1686,12 @@
     while (pListNode) {
       CFX_WideString wsOldValue;
       pListNode->TryContent(wsOldValue);
-      InsertListTextItem(pSaveItems, wsOldValue, i);
+      InsertListTextItem(pSaveItems, wsOldValue.AsWideStringC(), i);
       i++;
       pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling);
     }
-    InsertListTextItem(pNode, wsLabel, nIndex);
-    InsertListTextItem(pSaveItems, wsNewValue, nIndex);
+    InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex);
+    InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex);
   }
   if (!bNotify) {
     return;
@@ -2101,7 +2102,7 @@
         iTread_++;
         if (iTread_ > iTread) {
           if (iTread != -1) {
-            CFX_Decimal wsDeci = CFX_Decimal(wsValue);
+            CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsWideStringC());
             wsDeci.SetScale(iTread);
             wsRet = wsDeci;
           }
@@ -2276,8 +2277,8 @@
     if (wsLocaleName == FX_WSTRC(L"ambient")) {
       pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale();
     } else {
-      pLocale =
-          m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName);
+      pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(
+          wsLocaleName.AsWideStringC());
     }
   }
   return pLocale;
@@ -2332,7 +2333,7 @@
   wsValue = m_pNode->GetContent();
 
   if (eValueType == XFA_VALUEPICTURE_Display)
-    GetItemLabel(wsValue, wsValue);
+    GetItemLabel(wsValue.AsWideStringC(), wsValue);
 
   CFX_WideString wsPicture;
   GetPictureContent(wsPicture, eValueType);
@@ -2575,7 +2576,8 @@
   CFX_WideString wsFormatValue(wsValue);
   CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData();
   if (pContainerWidgetData) {
-    pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
+    pContainerWidgetData->GetFormatDataValue(wsValue.AsWideStringC(),
+                                             wsFormatValue);
   }
   m_pNode->SetContent(wsValue, wsFormatValue, bNotify);
 }
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index f4a479d..4c831d5 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -225,8 +225,8 @@
     CFX_WideString& wsNamespaceURI) {
   CFX_WideString wsNodeStr;
   pElement->GetNamespacePrefix(wsNodeStr);
-  if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNodeStr,
-                                                  wsNamespaceURI)) {
+  if (!XFA_FDEExtension_ResolveNamespaceQualifier(
+          pElement, wsNodeStr.AsWideStringC(), wsNamespaceURI)) {
     wsNamespaceURI.Empty();
   }
 }
@@ -283,8 +283,8 @@
       wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) {
     return FALSE;
   }
-  if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix,
-                                                  wsNamespaceURI)) {
+  if (!XFA_FDEExtension_ResolveNamespaceQualifier(
+          pElement, wsNSPrefix.AsWideStringC(), wsNamespaceURI)) {
     wsNamespaceURI.Empty();
     return FALSE;
   }
@@ -318,8 +318,8 @@
       }
       wsNSPrefix = wsAttrName.Left(iFind);
     }
-    if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix,
-                                                    wsAttrNS)) {
+    if (!XFA_FDEExtension_ResolveNamespaceQualifier(
+            pElement, wsNSPrefix.AsWideStringC(), wsAttrNS)) {
       continue;
     }
     if (bMatchNSAsPrefix) {
@@ -433,7 +433,8 @@
           reinterpret_cast<CFDE_XMLElement*>(pChildItem);
       CFX_WideString wsPacketName;
       pElement->GetLocalTagName(wsPacketName);
-      const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByName(wsPacketName);
+      const XFA_PACKETINFO* pPacketInfo =
+          XFA_GetPacketByName(wsPacketName.AsWideStringC());
       if (pPacketInfo && pPacketInfo->pURI) {
         if (!XFA_FDEExtension_MatchNodeName(pElement, pPacketInfo->pName,
                                             pPacketInfo->pURI,
@@ -585,7 +586,7 @@
       }
       pNode->SetCData(XFA_ATTRIBUTE_Name,
                       XFA_GetPacketByIndex(XFA_PACKET_Form)->pName);
-      pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum);
+      pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsWideStringC());
       CXFA_Node* pTemplateRoot =
           m_pRootNode->GetFirstChildByClass(XFA_ELEMENT_Template);
       CXFA_Node* pTemplateChosen =
@@ -821,7 +822,8 @@
         CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
         CFX_WideString wsTagName;
         pXMLElement->GetLocalTagName(wsTagName);
-        const XFA_ELEMENTINFO* pElemInfo = XFA_GetElementByName(wsTagName);
+        const XFA_ELEMENTINFO* pElemInfo =
+            XFA_GetElementByName(wsTagName.AsWideStringC());
         if (!pElemInfo) {
           continue;
         }
@@ -841,7 +843,8 @@
           return NULL;
         }
         if (ePacketID == XFA_XDPPACKET_Config) {
-          pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName);
+          pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name,
+                                  wsTagName.AsWideStringC());
         }
         FX_BOOL IsNeedValue = TRUE;
         for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count;
@@ -850,14 +853,14 @@
           CFX_WideString wsAttrName;
           CFX_WideString wsAttrValue;
           pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue);
-          XFA_FDEExtension_GetAttributeLocalName(wsAttrQualifiedName,
-                                                 wsAttrName);
+          XFA_FDEExtension_GetAttributeLocalName(
+              wsAttrQualifiedName.AsWideStringC(), wsAttrName);
           if (wsAttrName == FX_WSTRC(L"nil") &&
               wsAttrValue == FX_WSTRC(L"true")) {
             IsNeedValue = FALSE;
           }
           const XFA_ATTRIBUTEINFO* lpAttrInfo =
-              XFA_GetAttributeByName(wsAttrName);
+              XFA_GetAttributeByName(wsAttrName.AsWideStringC());
           if (!lpAttrInfo) {
             continue;
           }
@@ -865,7 +868,8 @@
               lpAttrInfo->eName != XFA_ATTRIBUTE_Save) {
             continue;
           }
-          pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue);
+          pXFAChild->SetAttribute(lpAttrInfo->eName,
+                                  wsAttrValue.AsWideStringC());
         }
         pXFANode->InsertChild(pXFAChild);
         if (pElemInfo->eName == XFA_ELEMENT_Validate ||
@@ -1108,8 +1112,8 @@
             CFX_WideString wsAttrNamespaceURI;
             pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue);
             if (!XFA_FDEExtension_ResolveAttribute(
-                    pXMLElement, wsAttrQualifiedName, wsAttrName,
-                    wsAttrNamespaceURI)) {
+                    pXMLElement, wsAttrQualifiedName.AsWideStringC(),
+                    wsAttrName, wsAttrNamespaceURI)) {
               continue;
             }
             if (wsAttrName == FX_WSTRC(L"nil") &&
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
index b7e3bb3..08e9ced 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
@@ -164,7 +164,8 @@
     CFX_ByteString bsValue;
     FXJSE_Value_ToUTF8String(hValue, bsValue);
     pNotify->GetDocProvider()->SetTitle(
-        hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()));
+        hDoc,
+        CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC());
     return;
   }
   CFX_WideString wsTitle;
@@ -292,7 +293,7 @@
     CFX_ByteString bsURL = pArguments->GetUTF8String(0);
     wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength());
   }
-  pNotify->GetDocProvider()->GotoURL(hDoc, wsURL);
+  pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsWideStringC());
 }
 void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList(
     CFXJSE_Arguments* pArguments) {
@@ -331,8 +332,8 @@
       uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                         XFA_RESOLVENODE_Siblings;
       XFA_RESOLVENODE_RS resoveNodeRS;
-      int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
-                                                    resoveNodeRS, dwFlag);
+      int32_t iRet = pScriptContext->ResolveObjects(
+          pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag);
       if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
         FXJSE_Value_Release(hValue);
         return;
@@ -385,8 +386,9 @@
     bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE;
   }
   CFX_WideString wsAnswer;
-  pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle,
-                                      wsDefaultAnswer, bMark);
+  pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsWideStringC(),
+                                      wsTitle.AsWideStringC(),
+                                      wsDefaultAnswer.AsWideStringC(), bMark);
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
   if (hValue) {
     FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsByteStringC());
@@ -454,7 +456,7 @@
   CXFA_Node* pNode = NULL;
   int32_t iExpLength = wsExpression.GetLength();
   while (iStart < iExpLength) {
-    iStart = XFA_FilterName(wsExpression, iStart, wsName);
+    iStart = XFA_FilterName(wsExpression.AsWideStringC(), iStart, wsName);
     CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
     if (!pScriptContext) {
       return;
@@ -466,8 +468,8 @@
     uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                       XFA_RESOLVENODE_Siblings;
     XFA_RESOLVENODE_RS resoveNodeRS;
-    int32_t iRet =
-        pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag);
+    int32_t iRet = pScriptContext->ResolveObjects(
+        pObject, wsName.AsWideStringC(), resoveNodeRS, dwFlag);
     if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
       continue;
     }
@@ -535,8 +537,8 @@
       uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
                         XFA_RESOLVENODE_Siblings;
       XFA_RESOLVENODE_RS resoveNodeRS;
-      int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
-                                                    resoveNodeRS, dwFlag);
+      int32_t iRet = pScriptContext->ResolveObjects(
+          pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag);
       if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
         FXJSE_Value_Release(hValue);
         return;
@@ -601,7 +603,8 @@
     }
   }
   int32_t iValue = pNotify->GetAppProvider()->MsgBox(
-      wsMessage, bsTitle, dwMessageType, dwButtonType);
+      wsMessage.AsWideStringC(), bsTitle.AsWideStringC(), dwMessageType,
+      dwButtonType);
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
   if (hValue) {
     FXJSE_Value_SetInteger(hValue, iValue);
@@ -733,7 +736,7 @@
     wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength());
   }
   CXFA_FFDoc* hDoc = pNotify->GetHDOC();
-  pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath);
+  pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsWideStringC());
 }
 void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData(
     CFXJSE_Arguments* pArguments) {
@@ -756,7 +759,7 @@
   if (iLength >= 2) {
     bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
   }
-  pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
+  pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsWideStringC(), bXDP);
 }
 void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp(
     CFXJSE_Arguments* pArguments) {
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index b85e9b7..fe6caa8 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -124,8 +124,8 @@
   if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
     pRefNode = ToNode(lpCurNode);
   }
-  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag,
-                                       TRUE)) {
+  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(),
+                                       hValue, dwFlag, TRUE)) {
     return;
   }
   if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
@@ -198,13 +198,13 @@
   if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) {
     pRefNode = ToNode(lpCurNode);
   }
-  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag,
-                                       FALSE)) {
+  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(),
+                                       hValue, dwFlag, FALSE)) {
     return;
   }
   dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings;
-  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag,
-                                       FALSE)) {
+  if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(),
+                                       hValue, dwFlag, FALSE)) {
     return;
   }
   CXFA_Object* pScriptObject =
@@ -243,8 +243,8 @@
   }
   uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
                     XFA_RESOLVENODE_Attributes;
-  FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName,
-                                                  hValue, dwFlag, FALSE);
+  FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(
+      ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE);
   if (bRet) {
     return;
   }
@@ -252,8 +252,8 @@
       (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript &&
        !lpScriptContext->IsStrictScopeInJavaScript())) {
     dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings;
-    bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, hValue,
-                                            dwFlag, FALSE);
+    bRet = lpScriptContext->QueryNodeByFlag(
+        ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE);
   }
   if (bRet) {
     return;
@@ -281,8 +281,8 @@
   CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject);
   CFX_WideString wsPropName = CFX_WideString::FromUTF8(
       (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength());
-  const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
-      XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName);
+  const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(
+      pObject->GetClassID(), wsPropName.AsWideStringC());
   if (lpAttributeInfo) {
     (pObject->*(lpAttributeInfo->lpfnCallback))(
         hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
@@ -293,17 +293,18 @@
       }
       CXFA_Node* pNode = ToNode(pObject);
       CXFA_Node* pPropOrChild = NULL;
-      const XFA_ELEMENTINFO* lpElementInfo = XFA_GetElementByName(wsPropName);
+      const XFA_ELEMENTINFO* lpElementInfo =
+          XFA_GetElementByName(wsPropName.AsWideStringC());
       if (lpElementInfo) {
         pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName);
       } else {
-        pPropOrChild = pNode->GetFirstChildByName(wsPropName);
+        pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsWideStringC());
       }
       if (pPropOrChild) {
         CFX_WideString wsDefaultName = FX_WSTRC(L"{default}");
         const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
             XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(),
-                                         wsDefaultName);
+                                         wsDefaultName.AsWideStringC());
         if (lpAttributeInfo) {
           (pPropOrChild->*(lpAttributeInfo->lpfnCallback))(
               hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
@@ -333,10 +334,11 @@
   XFA_ELEMENT objElement = pObject->GetClassID();
   CFX_WideString wsPropName = CFX_WideString::FromUTF8(
       (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength());
-  if (XFA_GetMethodByName(objElement, wsPropName)) {
+  if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) {
     return FXJSE_ClassPropType_Method;
   }
-  if (bQueryIn && !XFA_GetScriptAttributeByName(objElement, wsPropName)) {
+  if (bQueryIn &&
+      !XFA_GetScriptAttributeByName(objElement, wsPropName.AsWideStringC())) {
     return FXJSE_ClassPropType_None;
   }
   return FXJSE_ClassPropType_Property;
@@ -355,7 +357,7 @@
   XFA_ELEMENT objElement = pObject->GetClassID();
   CFX_WideString wsPropName = CFX_WideString::FromUTF8(
       (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength());
-  if (XFA_GetMethodByName(objElement, wsPropName)) {
+  if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) {
     return FXJSE_ClassPropType_Method;
   }
   return FXJSE_ClassPropType_Property;
@@ -373,7 +375,7 @@
   CFX_WideString wsFunName = CFX_WideString::FromUTF8(
       (const FX_CHAR*)szFuncName.raw_str(), szFuncName.GetLength());
   const XFA_METHODINFO* lpMethodInfo =
-      XFA_GetMethodByName(pObject->GetClassID(), wsFunName);
+      XFA_GetMethodByName(pObject->GetClassID(), wsFunName.AsWideStringC());
   if (NULL == lpMethodInfo) {
     return;
   }
diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
index 922b0d6..1b70dff 100644
--- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
@@ -117,7 +117,7 @@
       measure.Set(rtRect.top, XFA_UNIT_Pt);
       break;
   }
-  XFA_UNIT unit = measure.GetUnit(wsUnit);
+  XFA_UNIT unit = measure.GetUnit(wsUnit.AsWideStringC());
   FX_FLOAT fValue = measure.ToUnit(unit);
   fValue = FXSYS_round(fValue * 1000) / 1000.0f;
   if (hValue) {
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
index d7a1e29..9e8ff51 100644
--- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp
+++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
@@ -368,7 +368,8 @@
     XFA_CreateNode_ForCondition(wsCondition);
   }
   if (bIsClassName) {
-    const XFA_ELEMENTINFO* lpElement = XFA_GetElementByName(wsName);
+    const XFA_ELEMENTINFO* lpElement =
+        XFA_GetElementByName(wsName.AsWideStringC());
     if (lpElement == NULL) {
       return FALSE;
     }
@@ -391,7 +392,7 @@
     for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) {
       CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType);
       if (pNewNode) {
-        pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName);
+        pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsWideStringC());
         pNewNode->CreateXMLMappingNode();
         m_pCreateParent->InsertChild(pNewNode);
         if (iIndex == m_iCreateCount - 1) {
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
index a71270a..8ad8b13 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
@@ -35,7 +35,8 @@
   }
   if (!rnd.m_CurNode->IsNode()) {
     if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) {
-      return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, rnd.m_wsName);
+      return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd,
+                                             rnd.m_wsName.AsWideStringC());
     }
     return 0;
   }
@@ -70,7 +71,7 @@
       rnd.m_Nodes.Add(rnd.m_CurNode);
     } else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) &&
                XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd,
-                                               rnd.m_wsName)) {
+                                               rnd.m_wsName.AsWideStringC())) {
       return 1;
     }
     if (rnd.m_Nodes.GetSize() > 0) {
@@ -168,7 +169,7 @@
   CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1);
   CFX_WideString wsCondition = rnd.m_wsCondition;
   CXFA_Node* curNode = ToNode(rnd.m_CurNode);
-  if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) {
+  if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) {
     return 1;
   }
   CXFA_ResolveNodesData rndFind;
@@ -331,7 +332,7 @@
     }
   }
   if (dwStyles & XFA_RESOLVENODE_Attributes) {
-    if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) {
+    if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) {
       return 1;
     }
   }
@@ -365,7 +366,8 @@
         pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE);
       }
     } else {
-      const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(wsName);
+      const XFA_ELEMENTINFO* pElement =
+          XFA_GetElementByName(wsName.AsWideStringC());
       if (pElement) {
         pProp = curNode->AsNode()->GetProperty(
             0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet);
@@ -711,7 +713,8 @@
     CXFA_Object* node = findNodes[i];
     FX_BOOL bRet = FALSE;
     FXJSE_HVALUE pRetValue = FXJSE_Value_Create(rnd.m_pSC->GetRuntime());
-    bRet = pContext->RunScript(eLangType, wsExpression, pRetValue, node);
+    bRet = pContext->RunScript(eLangType, wsExpression.AsWideStringC(),
+                               pRetValue, node);
     if (!bRet || !FXJSE_Value_ToBoolean(pRetValue)) {
       findNodes.RemoveAt(i);
     }
diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
index 2919664..f460cf7 100644
--- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
@@ -75,8 +75,9 @@
     CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2);
     wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength());
   }
-  FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression,
-                                                  wsXMLIdent);
+  FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList,
+                                                  wsExpression.AsWideStringC(),
+                                                  wsXMLIdent.AsWideStringC());
   FXJSE_HVALUE hValue = pArguments->GetReturnValue();
   if (hValue) {
     FXJSE_Value_SetBoolean(hValue, bSign);
diff --git a/xfa/include/fxfa/xfa_ffwidget.h b/xfa/include/fxfa/xfa_ffwidget.h
index 70ac919..f82bf2f 100644
--- a/xfa/include/fxfa/xfa_ffwidget.h
+++ b/xfa/include/fxfa/xfa_ffwidget.h
@@ -164,7 +164,7 @@
                                       FXCODEC_IMAGE_TYPE type,
                                       int32_t& iImageXDpi,
                                       int32_t& iImageYDpi);
-FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType);
+FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType);
 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len);
 void XFA_RectWidthoutMargin(CFX_RectF& rt,
                             const CXFA_Margin& mg,