Rename WideString::{UTF8,UTF16LE}_Encode() to To{UTF8,UTF16LE}().
Make consistent with ToDefANSI().
Change-Id: I576f5a8a2bb3f633c7dca67efd7712fa610acf4d
Reviewed-on: https://pdfium-review.googlesource.com/c/45791
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 3c0ec30..0e553b2 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -86,7 +86,7 @@
pAnnotDict->SetNewFor<CPDF_Name>("Subtype", "Popup");
pAnnotDict->SetNewFor<CPDF_String>("T", pParentDict->GetStringFor("T"),
false);
- pAnnotDict->SetNewFor<CPDF_String>("Contents", sContents.UTF8Encode(), false);
+ pAnnotDict->SetNewFor<CPDF_String>("Contents", sContents.ToUTF8(), false);
CFX_FloatRect rect = pParentDict->GetRectFor("Rect");
rect.Normalize();
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 73fc8a4..14c3ad6 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -205,7 +205,7 @@
// Check that the file content stream is as expected.
EXPECT_STREQ(
streams[i],
- file_spec.GetFileStream()->GetUnicodeText().UTF8Encode().c_str());
+ file_spec.GetFileStream()->GetUnicodeText().ToUTF8().c_str());
if (i == 2) {
dict_obj->SetNewFor<CPDF_String>("FS", "URL", false);
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index af5d15d..39e422d 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -17,32 +17,32 @@
CPDF_Dictionary* root = obj_holder.NewIndirect<CPDF_Dictionary>();
root->SetNewFor<CPDF_Name>("T", "foo");
name = FPDF_GetFullName(root);
- EXPECT_STREQ("foo", name.UTF8Encode().c_str());
+ EXPECT_STREQ("foo", name.ToUTF8().c_str());
CPDF_Dictionary* dict1 = obj_holder.NewIndirect<CPDF_Dictionary>();
root->SetNewFor<CPDF_Reference>("Parent", &obj_holder, dict1->GetObjNum());
dict1->SetNewFor<CPDF_Name>("T", "bar");
name = FPDF_GetFullName(root);
- EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
+ EXPECT_STREQ("bar.foo", name.ToUTF8().c_str());
CPDF_Dictionary* dict2 = dict1->SetNewFor<CPDF_Dictionary>("Parent");
name = FPDF_GetFullName(root);
- EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
+ EXPECT_STREQ("bar.foo", name.ToUTF8().c_str());
CPDF_Dictionary* dict3 = obj_holder.NewIndirect<CPDF_Dictionary>();
dict2->SetNewFor<CPDF_Reference>("Parent", &obj_holder, dict3->GetObjNum());
dict3->SetNewFor<CPDF_Name>("T", "qux");
name = FPDF_GetFullName(root);
- EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
+ EXPECT_STREQ("qux.bar.foo", name.ToUTF8().c_str());
dict3->SetNewFor<CPDF_Reference>("Parent", &obj_holder, root->GetObjNum());
name = FPDF_GetFullName(root);
- EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
+ EXPECT_STREQ("qux.bar.foo", name.ToUTF8().c_str());
name = FPDF_GetFullName(dict1);
- EXPECT_STREQ("foo.qux.bar", name.UTF8Encode().c_str());
+ EXPECT_STREQ("foo.qux.bar", name.ToUTF8().c_str());
name = FPDF_GetFullName(dict2);
- EXPECT_STREQ("bar.foo.qux", name.UTF8Encode().c_str());
+ EXPECT_STREQ("bar.foo.qux", name.ToUTF8().c_str());
name = FPDF_GetFullName(dict3);
- EXPECT_STREQ("bar.foo.qux", name.UTF8Encode().c_str());
+ EXPECT_STREQ("bar.foo.qux", name.ToUTF8().c_str());
}
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 55bb83b..234270e 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -654,11 +654,11 @@
return bstr;
}
-ByteString WideString::UTF8Encode() const {
+ByteString WideString::ToUTF8() const {
return FX_UTF8Encode(AsStringView());
}
-ByteString WideString::UTF16LE_Encode() const {
+ByteString WideString::ToUTF16LE() const {
if (!m_pData)
return ByteString("\0\0", 2);
@@ -1033,7 +1033,7 @@
}
std::ostream& operator<<(std::ostream& os, const WideString& str) {
- os << str.UTF8Encode();
+ os << str.ToUTF8();
return os;
}
diff --git a/core/fxcrt/widestring.h b/core/fxcrt/widestring.h
index 3c81093..70339ff 100644
--- a/core/fxcrt/widestring.h
+++ b/core/fxcrt/widestring.h
@@ -192,12 +192,12 @@
size_t Remove(wchar_t ch);
ByteString ToDefANSI() const;
- ByteString UTF8Encode() const;
+ ByteString ToUTF8() const;
// This method will add \0\0 to the end of the string to represent the
// wide string terminator. These values are in the string, not just the data,
// so GetLength() will include them.
- ByteString UTF16LE_Encode() const;
+ ByteString ToUTF16LE() const;
protected:
using StringData = StringDataTemplate<wchar_t>;
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 601e287..2d8a676 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -981,7 +981,7 @@
EXPECT_TRUE(iter == multi_str.rbegin());
}
-TEST(WideString, UTF16LE_Encode) {
+TEST(WideString, ToUTF16LE) {
struct UTF16LEEncodeCase {
WideString ws;
ByteString bs;
@@ -996,7 +996,7 @@
for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
EXPECT_EQ(utf16le_encode_cases[i].bs,
- utf16le_encode_cases[i].ws.UTF16LE_Encode())
+ utf16le_encode_cases[i].ws.ToUTF16LE())
<< " for case number " << i;
}
}
diff --git a/core/fxcrt/xml/cfx_xmlchardata.cpp b/core/fxcrt/xml/cfx_xmlchardata.cpp
index d5fae18..395435c 100644
--- a/core/fxcrt/xml/cfx_xmlchardata.cpp
+++ b/core/fxcrt/xml/cfx_xmlchardata.cpp
@@ -24,6 +24,6 @@
void CFX_XMLCharData::Save(
const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) {
pXMLStream->WriteString("<![CDATA[");
- pXMLStream->WriteString(GetText().UTF8Encode().AsStringView());
+ pXMLStream->WriteString(GetText().ToUTF8().AsStringView());
pXMLStream->WriteString("]]>");
}
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 87e50f4..02b3fcc 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -84,7 +84,7 @@
void CFX_XMLElement::Save(
const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) {
- ByteString bsNameEncoded = name_.UTF8Encode();
+ ByteString bsNameEncoded = name_.ToUTF8();
pXMLStream->WriteString("<");
pXMLStream->WriteString(bsNameEncoded.AsStringView());
@@ -93,7 +93,7 @@
// Note, the space between attributes is added by AttributeToString which
// writes a blank as the first character.
pXMLStream->WriteString(
- AttributeToString(it.first, it.second).UTF8Encode().AsStringView());
+ AttributeToString(it.first, it.second).ToUTF8().AsStringView());
}
if (!GetFirstChild()) {
diff --git a/core/fxcrt/xml/cfx_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp
index fb534e3..73fe548 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp
@@ -47,11 +47,11 @@
}
pXMLStream->WriteString("<?");
- pXMLStream->WriteString(name_.UTF8Encode().AsStringView());
+ pXMLStream->WriteString(name_.ToUTF8().AsStringView());
pXMLStream->WriteString(" ");
for (const WideString& target : target_data_) {
- pXMLStream->WriteString(target.UTF8Encode().AsStringView());
+ pXMLStream->WriteString(target.ToUTF8().AsStringView());
pXMLStream->WriteString(" ");
}
diff --git a/core/fxcrt/xml/cfx_xmltext.cpp b/core/fxcrt/xml/cfx_xmltext.cpp
index b6c1be7..b73316b 100644
--- a/core/fxcrt/xml/cfx_xmltext.cpp
+++ b/core/fxcrt/xml/cfx_xmltext.cpp
@@ -21,6 +21,5 @@
}
void CFX_XMLText::Save(const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) {
- pXMLStream->WriteString(
- EncodeEntities(GetText()).UTF8Encode().AsStringView());
+ pXMLStream->WriteString(EncodeEntities(GetText()).ToUTF8().AsStringView());
}
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 9e8f4bf..3260908 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -72,8 +72,8 @@
return -1;
}
- ByteString bsMsg = Msg.UTF16LE_Encode();
- ByteString bsTitle = Title.UTF16LE_Encode();
+ ByteString bsMsg = Msg.ToUTF16LE();
+ ByteString bsTitle = Title.ToUTF16LE();
return m_pInfo->m_pJsPlatform->app_alert(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg),
AsFPDFWideString(&bsTitle), Type, Icon);
@@ -90,10 +90,10 @@
!m_pInfo->m_pJsPlatform->app_response) {
return -1;
}
- ByteString bsQuestion = Question.UTF16LE_Encode();
- ByteString bsTitle = Title.UTF16LE_Encode();
- ByteString bsDefault = Default.UTF16LE_Encode();
- ByteString bsLabel = Label.UTF16LE_Encode();
+ ByteString bsQuestion = Question.ToUTF16LE();
+ ByteString bsTitle = Title.ToUTF16LE();
+ ByteString bsDefault = Default.ToUTF16LE();
+ ByteString bsLabel = Label.ToUTF16LE();
return m_pInfo->m_pJsPlatform->app_response(
m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion),
AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault),
@@ -140,11 +140,11 @@
!m_pInfo->m_pJsPlatform->Doc_mail) {
return;
}
- ByteString bsTo = To.UTF16LE_Encode();
- ByteString bsSubject = Subject.UTF16LE_Encode();
- ByteString bsCC = CC.UTF16LE_Encode();
- ByteString bsBcc = BCC.UTF16LE_Encode();
- ByteString bsMsg = Msg.UTF16LE_Encode();
+ ByteString bsTo = To.ToUTF16LE();
+ ByteString bsSubject = Subject.ToUTF16LE();
+ ByteString bsCC = CC.ToUTF16LE();
+ ByteString bsBcc = BCC.ToUTF16LE();
+ ByteString bsMsg = Msg.ToUTF16LE();
m_pInfo->m_pJsPlatform->Doc_mail(
m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo),
AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC),
@@ -204,7 +204,7 @@
!m_pInfo->m_pJsPlatform->Doc_submitForm) {
return;
}
- ByteString bsUrl = URL.UTF16LE_Encode();
+ ByteString bsUrl = URL.ToUTF16LE();
m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData,
length, AsFPDFWideString(&bsUrl));
}
@@ -376,7 +376,7 @@
if (!m_pInfo || !m_pInfo->FFI_GotoURL)
return;
- ByteString bsTo = wsURL.UTF16LE_Encode();
+ ByteString bsTo = wsURL.ToUTF16LE();
m_pInfo->FFI_GotoURL(m_pInfo, FPDFDocumentFromCPDFDocument(m_pCPDFDoc.Get()),
AsFPDFWideString(&bsTo));
}
@@ -438,7 +438,7 @@
if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL)
return nullptr;
- ByteString bstrURL = url.UTF16LE_Encode();
+ ByteString bstrURL = url.ToUTF16LE();
FPDF_LPFILEHANDLER fileHandler =
m_pInfo->FFI_DownloadFromURL(m_pInfo, AsFPDFWideString(&bstrURL));
@@ -454,11 +454,11 @@
if (!m_pInfo || !m_pInfo->FFI_PostRequestURL)
return L"";
- ByteString bsURL = wsURL.UTF16LE_Encode();
- ByteString bsData = wsData.UTF16LE_Encode();
- ByteString bsContentType = wsContentType.UTF16LE_Encode();
- ByteString bsEncode = wsEncode.UTF16LE_Encode();
- ByteString bsHeader = wsHeader.UTF16LE_Encode();
+ ByteString bsURL = wsURL.ToUTF16LE();
+ ByteString bsData = wsData.ToUTF16LE();
+ ByteString bsContentType = wsContentType.ToUTF16LE();
+ ByteString bsEncode = wsEncode.ToUTF16LE();
+ ByteString bsHeader = wsHeader.ToUTF16LE();
FPDF_BSTR response;
FPDF_BStr_Init(&response);
@@ -482,9 +482,9 @@
if (!m_pInfo || !m_pInfo->FFI_PutRequestURL)
return false;
- ByteString bsURL = wsURL.UTF16LE_Encode();
- ByteString bsData = wsData.UTF16LE_Encode();
- ByteString bsEncode = wsEncode.UTF16LE_Encode();
+ ByteString bsURL = wsURL.ToUTF16LE();
+ ByteString bsData = wsData.ToUTF16LE();
+ ByteString bsEncode = wsEncode.ToUTF16LE();
return m_pInfo->FFI_PutRequestURL(m_pInfo, AsFPDFWideString(&bsURL),
AsFPDFWideString(&bsData),
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index f9657ae..8442f61 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -171,7 +171,7 @@
ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
return WideString::FromUTF16LE(wide_string,
WideString::WStringLength(wide_string))
- .UTF8Encode();
+ .ToUTF8();
}
void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
@@ -323,7 +323,7 @@
unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text,
void* buffer,
unsigned long buflen) {
- ByteString encoded_text = text.UTF16LE_Encode();
+ ByteString encoded_text = text.ToUTF16LE();
unsigned long len = encoded_text.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encoded_text.c_str(), len);
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index f163c78..0123837 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -245,7 +245,7 @@
WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.ToUTF16LE();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 76b2ec1..a591d37 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -253,7 +253,7 @@
WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
- ByteString bsUTFText = wsText.UTF16LE_Encode();
+ ByteString bsUTFText = wsText.ToUTF16LE();
auto* pBuffer = reinterpret_cast<const unsigned short*>(bsUTFText.c_str());
m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true);
}
diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp
index 0a2f589..e9224d1 100644
--- a/fpdfsdk/fpdf_doc.cpp
+++ b/fpdfsdk/fpdf_doc.cpp
@@ -183,7 +183,7 @@
return 0;
CPDF_Action action(CPDFDictionaryFromFPDFAction(pDict));
- ByteString path = action.GetFilePath().UTF8Encode();
+ ByteString path = action.GetFilePath().ToUTF8();
unsigned long len = path.GetLength() + 1;
if (buffer && len <= buflen)
memcpy(buffer, path.c_str(), len);
diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp
index 74aa592..6623f39 100644
--- a/fpdfsdk/fpdf_structtree.cpp
+++ b/fpdfsdk/fpdf_structtree.cpp
@@ -20,7 +20,7 @@
if (str.IsEmpty())
return 0;
- ByteString encodedStr = str.UTF16LE_Encode();
+ ByteString encodedStr = str.ToUTF16LE();
const unsigned long len = encodedStr.GetLength();
if (buffer && len <= buflen)
memcpy(buffer, encodedStr.c_str(), len);
diff --git a/fpdfsdk/fpdf_text.cpp b/fpdfsdk/fpdf_text.cpp
index a39402e..465c18e 100644
--- a/fpdfsdk/fpdf_text.cpp
+++ b/fpdfsdk/fpdf_text.cpp
@@ -204,7 +204,7 @@
// UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
// the number of items to stay the same.
- ByteString byte_str = str.UTF16LE_Encode();
+ ByteString byte_str = str.ToUTF16LE();
size_t byte_str_len = byte_str.GetLength();
int ret_count = byte_str_len / kBytesPerCharacter;
@@ -260,7 +260,7 @@
if (buflen <= 0 || !buffer)
return str.GetLength();
- ByteString cbUTF16Str = str.UTF16LE_Encode();
+ ByteString cbUTF16Str = str.ToUTF16LE();
int len = cbUTF16Str.GetLength() / sizeof(unsigned short);
int size = buflen > len ? len : buflen;
memcpy(buffer, cbUTF16Str.c_str(), size * sizeof(unsigned short));
@@ -361,7 +361,7 @@
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
wsUrl = pageLink->GetURL(link_index);
}
- ByteString cbUTF16URL = wsUrl.UTF16LE_Encode();
+ ByteString cbUTF16URL = wsUrl.ToUTF16LE();
int required = cbUTF16URL.GetLength() / sizeof(unsigned short);
if (!buffer || buflen <= 0)
return required;
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 769ff2a..647d6d2 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -1159,7 +1159,7 @@
if (!pDestObj->IsArray())
return nullptr;
- ByteString utf16Name = wsName.UTF16LE_Encode();
+ ByteString utf16Name = wsName.ToUTF16LE();
int len = utf16Name.GetLength();
if (!buffer) {
*buflen = len;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index c781ba1..05ad437 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -428,7 +428,7 @@
return;
int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML;
- ByteString bs = wsFilePath.UTF16LE_Encode();
+ ByteString bs = wsFilePath.ToUTF16LE();
if (wsFilePath.IsEmpty()) {
if (!pFormFillEnv->GetFormFillInfo() ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) {
@@ -436,7 +436,7 @@
}
WideString filepath = pFormFillEnv->JS_fieldBrowse();
- bs = filepath.UTF16LE_Encode();
+ bs = filepath.ToUTF16LE();
}
FPDF_FILEHANDLER* pFileHandler = pFormFillEnv->OpenFile(
bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML, AsFPDFWideString(&bs), "wb");
@@ -496,7 +496,7 @@
WideString wPath = WideString::FromUTF16LE(
reinterpret_cast<const unsigned short*>(bs.c_str()),
bs.GetLength() / sizeof(unsigned short));
- ByteString bPath = wPath.UTF8Encode();
+ ByteString bPath = wPath.ToUTF8();
static const char kFormat[] =
"\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>";
ByteString content = ByteString::Format(kFormat, bPath.c_str());
@@ -700,7 +700,7 @@
if (!pFormFillEnv)
return nullptr;
- ByteString bs = wsLink.UTF16LE_Encode();
+ ByteString bs = wsLink.ToUTF16LE();
FPDF_FILEHANDLER* pFileHandler =
pFormFillEnv->OpenFile(0, AsFPDFWideString(&bs), "rb");
if (!pFileHandler)
@@ -952,11 +952,11 @@
csMsg)) {
return false;
}
- ByteString bsTo = WideString(csToAddress).UTF16LE_Encode();
- ByteString bsCC = WideString(csCCAddress).UTF16LE_Encode();
- ByteString bsBcc = WideString(csBCCAddress).UTF16LE_Encode();
- ByteString bsSubject = WideString(csSubject).UTF16LE_Encode();
- ByteString bsMsg = WideString(csMsg).UTF16LE_Encode();
+ ByteString bsTo = WideString(csToAddress).ToUTF16LE();
+ ByteString bsCC = WideString(csCCAddress).ToUTF16LE();
+ ByteString bsBcc = WideString(csBCCAddress).ToUTF16LE();
+ ByteString bsSubject = WideString(csSubject).ToUTF16LE();
+ ByteString bsMsg = WideString(csMsg).ToUTF16LE();
pFormFillEnv->EmailTo(pFileHandler, AsFPDFWideString(&bsTo),
AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC),
AsFPDFWideString(&bsBcc), AsFPDFWideString(&bsMsg));
@@ -964,7 +964,7 @@
}
// HTTP or FTP
- ByteString bs = csURL.UTF16LE_Encode();
+ ByteString bs = csURL.ToUTF16LE();
pFormFillEnv->UploadTo(pFileHandler, fileFlag, AsFPDFWideString(&bs));
return true;
}
diff --git a/fxbarcode/BC_UtilCodingConvert.cpp b/fxbarcode/BC_UtilCodingConvert.cpp
index f367c21..eef1342 100644
--- a/fxbarcode/BC_UtilCodingConvert.cpp
+++ b/fxbarcode/BC_UtilCodingConvert.cpp
@@ -18,13 +18,13 @@
void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
ByteString& dst) {
WideString unicode = WideString::FromDefANSI(src.AsStringView());
- dst = unicode.UTF8Encode();
+ dst = unicode.ToUTF8();
}
void CBC_UtilCodingConvert::LocaleToUtf8(const ByteString& src,
std::vector<uint8_t>& dst) {
WideString unicode = WideString::FromDefANSI(src.AsStringView());
- ByteString utf8 = unicode.UTF8Encode();
+ ByteString utf8 = unicode.ToUTF8();
dst = std::vector<uint8_t>(utf8.begin(), utf8.end());
}
@@ -45,5 +45,5 @@
void CBC_UtilCodingConvert::UnicodeToUTF8(const WideString& src,
ByteString& dst) {
- dst = src.UTF8Encode();
+ dst = src.ToUTF8();
}
diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index 700291b..1aace5e 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -39,7 +39,7 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
m_renderContents = GetOnedCodaBarWriter()->FilterContents(contents);
- ByteString byteString = m_renderContents.UTF8Encode();
+ ByteString byteString = m_renderContents.ToUTF8();
auto* pWriter = GetOnedCodaBarWriter();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index 7a825c4..237ac57 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -44,7 +44,7 @@
content += '0';
m_renderContents = pWriter->FilterContents(content.AsStringView());
- ByteString byteString = m_renderContents.UTF8Encode();
+ ByteString byteString = m_renderContents.ToUTF8();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index 2031650..00c4bc0 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -41,7 +41,7 @@
auto* pWriter = GetOnedCode39Writer();
WideString filtercontents = pWriter->FilterContents(contents);
m_renderContents = pWriter->RenderTextContents(contents);
- ByteString byteString = filtercontents.UTF8Encode();
+ ByteString byteString = filtercontents.ToUTF8();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
return data && pWriter->RenderResult(m_renderContents.AsStringView(),
diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp
index 3d3dc0a..d2d69df 100644
--- a/fxbarcode/cbc_ean13.cpp
+++ b/fxbarcode/cbc_ean13.cpp
@@ -39,7 +39,7 @@
for (int32_t i = 0; i < 12 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.ToUTF8();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = WideString::FromUTF8(byteString.AsStringView());
@@ -58,7 +58,7 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
m_renderContents = Preprocess(contents);
- ByteString byteString = m_renderContents.UTF8Encode();
+ ByteString byteString = m_renderContents.ToUTF8();
auto* pWriter = GetOnedEAN13Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp
index ce071af..b7f6a7b 100644
--- a/fxbarcode/cbc_ean8.cpp
+++ b/fxbarcode/cbc_ean8.cpp
@@ -38,7 +38,7 @@
for (int32_t i = 0; i < 7 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.ToUTF8();
int32_t checksum = pWriter->CalcChecksum(byteString);
encodeContents += wchar_t(checksum - 0 + '0');
}
@@ -56,7 +56,7 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
m_renderContents = Preprocess(contents);
- ByteString byteString = m_renderContents.UTF8Encode();
+ ByteString byteString = m_renderContents.ToUTF8();
auto* pWriter = GetOnedEAN8Writer();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
pWriter->Encode(byteString, format, outWidth, outHeight));
diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp
index c608faa..c8f313a 100644
--- a/fxbarcode/cbc_upca.cpp
+++ b/fxbarcode/cbc_upca.cpp
@@ -38,7 +38,7 @@
for (int32_t i = 0; i < 11 - length; i++)
encodeContents = wchar_t('0') + encodeContents;
- ByteString byteString = encodeContents.UTF8Encode();
+ ByteString byteString = encodeContents.ToUTF8();
int32_t checksum = pWriter->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = WideString::FromUTF8(byteString.AsStringView());
@@ -57,7 +57,7 @@
int32_t outWidth = 0;
int32_t outHeight = 0;
m_renderContents = Preprocess(contents);
- ByteString byteString = m_renderContents.UTF8Encode();
+ ByteString byteString = m_renderContents.ToUTF8();
CBC_OnedUPCAWriter* pWriter = GetOnedUPCAWriter();
pWriter->Init();
std::unique_ptr<uint8_t, FxFreeDeleter> data(
diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp
index 1174f94..50862c9 100644
--- a/fxbarcode/oned/BC_OnedCode39Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp
@@ -230,7 +230,7 @@
*result = WideString(contents);
if (m_bCalcChecksum && m_bPrintChecksum) {
WideString checksumContent = FilterContents(contents);
- ByteString str = checksumContent.UTF8Encode();
+ ByteString str = checksumContent.ToUTF8();
char checksum;
checksum = CalcCheckSum(str);
if (checksum == '*')
diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index 19c3795..ea9806b 100644
--- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -321,7 +321,7 @@
while (idx < count) {
WideString tmp;
size_t len = 44 < count - idx ? 44 : count - idx;
- ByteString part = (L'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
+ ByteString part = (L'1' + msg.Mid(startpos + idx, len)).ToUTF8();
BigInteger bigint = stringToBigInteger(part.c_str());
do {
int32_t c = (bigint % num900).toInt();
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 70cacbb..d46c4bb 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -508,7 +508,7 @@
if (!wsScript)
return false;
- ByteString btScript = wsScript->UTF8Encode();
+ ByteString btScript = wsScript->ToUTF8();
auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
CXFA_Node* pThisObject = pParent->GetParent();
CFXJSE_Context* pVariablesContext =
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 848c693..f577e32 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -504,7 +504,7 @@
: pLocale->GetTimePattern(category);
if (!bStandard)
AlternateDateTimeSymbols(&strRet, pLocale->GetDateTimeSymbols(), bIsDate);
- return strRet.UTF8Encode();
+ return strRet.ToUTF8();
}
bool IsWhitespace(char c) {
@@ -2713,7 +2713,7 @@
WideString wsRet;
CXFA_LocaleValue(XFA_VT_DATE, WideString::FromUTF8(szDate), pMgr)
.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display);
- return wsRet.UTF8Encode();
+ return wsRet.ToUTF8();
}
// static
@@ -2737,7 +2737,7 @@
WideString wsRet;
widgetValue.FormatPatterns(wsRet, wsFormat, pLocale,
XFA_VALUEPICTURE_Display);
- return wsRet.UTF8Encode();
+ return wsRet.ToUTF8();
}
// static
@@ -3971,7 +3971,7 @@
return;
}
- args.GetReturnValue()->SetString(wsRet.UTF8Encode().AsStringView());
+ args.GetReturnValue()->SetString(wsRet.ToUTF8().AsStringView());
}
// static
@@ -4106,7 +4106,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringView());
+ localeValue.GetValue().ToUTF8().AsStringView());
return;
}
@@ -4130,7 +4130,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringView());
+ localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_DATE: {
@@ -4142,7 +4142,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringView());
+ localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_TIME: {
@@ -4154,7 +4154,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringView());
+ localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_TEXT: {
@@ -4166,7 +4166,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue.GetValue().UTF8Encode().AsStringView());
+ localeValue.GetValue().ToUTF8().AsStringView());
return;
}
case XFA_VT_FLOAT: {
@@ -4197,7 +4197,7 @@
return;
}
args.GetReturnValue()->SetString(
- localeValue2.GetValue().UTF8Encode().AsStringView());
+ localeValue2.GetValue().ToUTF8().AsStringView());
return;
}
}
@@ -4721,7 +4721,7 @@
pContext->ThrowServerDeniedException();
return;
}
- args.GetReturnValue()->SetString(decodedResponse.UTF8Encode().AsStringView());
+ args.GetReturnValue()->SetString(decodedResponse.ToUTF8().AsStringView());
}
// static
@@ -6235,5 +6235,5 @@
void CFXJSE_FormCalcContext::ThrowException(const WideString& str) const {
ASSERT(!str.IsEmpty());
- FXJSE_ThrowMessage(str.UTF8Encode().AsStringView());
+ FXJSE_ThrowMessage(str.ToUTF8().AsStringView());
}
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 176872f..523d88e 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -413,7 +413,7 @@
CFX_GlobalArray* pArray) {
std::vector<WideString> pKeyList = pRuntime->GetObjectPropertyNames(pObj);
for (const auto& ws : pKeyList) {
- ByteString sKey = ws.UTF8Encode();
+ ByteString sKey = ws.ToUTF8();
v8::Local<v8::Value> v = pRuntime->GetObjectProperty(pObj, ws);
if (v->IsNumber()) {
auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
diff --git a/fxjs/xfa/cjx_draw.cpp b/fxjs/xfa/cjx_draw.cpp
index 1754506..8408d85 100644
--- a/fxjs/xfa/cjx_draw.cpp
+++ b/fxjs/xfa/cjx_draw.cpp
@@ -111,7 +111,7 @@
if (content.IsEmpty())
pValue->SetNull();
else
- pValue->SetString(content.UTF8Encode().AsStringView());
+ pValue->SetString(content.ToUTF8().AsStringView());
return;
}
diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp
index b80f8f3..494681a 100644
--- a/fxjs/xfa/cjx_eventpseudomodel.cpp
+++ b/fxjs/xfa/cjx_eventpseudomodel.cpp
@@ -24,7 +24,7 @@
return;
}
- pReturn->SetString(wsValue->UTF8Encode().AsStringView());
+ pReturn->SetString(wsValue->ToUTF8().AsStringView());
}
void InterProperty(CFXJSE_Value* pReturn, int32_t* iValue, bool bSetting) {
@@ -112,7 +112,7 @@
if (!pEventParam)
return;
- pValue->SetString(pEventParam->GetNewText().UTF8Encode().AsStringView());
+ pValue->SetString(pEventParam->GetNewText().ToUTF8().AsStringView());
}
void CJX_EventPseudoModel::prevContentType(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp
index a5ddc94..a076e68 100644
--- a/fxjs/xfa/cjx_exclgroup.cpp
+++ b/fxjs/xfa/cjx_exclgroup.cpp
@@ -130,7 +130,7 @@
pValue->SetNull();
return;
}
- pValue->SetString(wsValue.UTF8Encode().AsStringView());
+ pValue->SetString(wsValue.ToUTF8().AsStringView());
}
void CJX_ExclGroup::rawValue(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp
index 453bac0..d22cf4e 100644
--- a/fxjs/xfa/cjx_field.cpp
+++ b/fxjs/xfa/cjx_field.cpp
@@ -110,7 +110,7 @@
return CJS_Result::Success(runtime->NewNull());
return CJS_Result::Success(
- runtime->NewString(value->UTF8Encode().AsStringView()));
+ runtime->NewString(value->ToUTF8().AsStringView()));
}
CJS_Result CJX_Field::boundItem(
@@ -126,7 +126,7 @@
WideString value = runtime->ToWideString(params[0]);
WideString boundValue = node->GetItemValue(value.AsStringView());
return CJS_Result::Success(
- runtime->NewString(boundValue.UTF8Encode().AsStringView()));
+ runtime->NewString(boundValue.ToUTF8().AsStringView()));
}
CJS_Result CJX_Field::getItemState(
@@ -176,7 +176,7 @@
return CJS_Result::Success(runtime->NewNull());
return CJS_Result::Success(
- runtime->NewString(value->UTF8Encode().AsStringView()));
+ runtime->NewString(value->ToUTF8().AsStringView()));
}
CJS_Result CJX_Field::setItemState(
@@ -276,7 +276,7 @@
if (xfaNode->GetUIChildNode()->GetElementType() ==
XFA_Element::NumericEdit &&
(pNode->JSObject()->GetInteger(XFA_Attribute::FracDigits) == -1)) {
- pValue->SetString(content.UTF8Encode().AsStringView());
+ pValue->SetString(content.ToUTF8().AsStringView());
} else {
CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
@@ -289,7 +289,7 @@
CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
} else {
- pValue->SetString(content.UTF8Encode().AsStringView());
+ pValue->SetString(content.ToUTF8().AsStringView());
}
}
@@ -305,7 +305,7 @@
return;
}
pValue->SetString(
- node->GetValue(XFA_VALUEPICTURE_Edit).UTF8Encode().AsStringView());
+ node->GetValue(XFA_VALUEPICTURE_Edit).ToUTF8().AsStringView());
}
void CJX_Field::formatMessage(CFXJSE_Value* pValue,
@@ -326,7 +326,7 @@
return;
}
pValue->SetString(
- node->GetValue(XFA_VALUEPICTURE_Display).UTF8Encode().AsStringView());
+ node->GetValue(XFA_VALUEPICTURE_Display).ToUTF8().AsStringView());
}
void CJX_Field::parentSubform(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 748641a..d6899cf 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -130,7 +130,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetLanguage().UTF8Encode().AsStringView());
+ pNotify->GetAppProvider()->GetLanguage().ToUTF8().AsStringView());
}
void CJX_HostPseudoModel::numPages(CFXJSE_Value* pValue,
@@ -160,7 +160,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetPlatform().UTF8Encode().AsStringView());
+ pNotify->GetAppProvider()->GetPlatform().ToUTF8().AsStringView());
}
void CJX_HostPseudoModel::title(CFXJSE_Value* pValue,
@@ -181,7 +181,7 @@
WideString wsTitle;
hDoc->GetDocEnvironment()->GetTitle(hDoc, wsTitle);
- pValue->SetString(wsTitle.UTF8Encode().AsStringView());
+ pValue->SetString(wsTitle.ToUTF8().AsStringView());
}
void CJX_HostPseudoModel::validationsEnabled(CFXJSE_Value* pValue,
@@ -236,7 +236,7 @@
return;
}
pValue->SetString(
- pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView());
+ pNotify->GetAppProvider()->GetAppName().ToUTF8().AsStringView());
}
CJS_Result CJX_HostPseudoModel::gotoURL(
@@ -340,7 +340,7 @@
WideString answer =
pNotify->GetAppProvider()->Response(question, title, defaultAnswer, mark);
return CJS_Result::Success(
- runtime->NewString(answer.UTF8Encode().AsStringView()));
+ runtime->NewString(answer.ToUTF8().AsStringView()));
}
CJS_Result CJX_HostPseudoModel::documentInBatch(
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index c78ddcc..d26b9b1 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -152,7 +152,7 @@
WideString expression = runtime->ToWideString(params[0]);
return CJS_Result::Success(runtime->NewString(
- GetAttribute(expression.AsStringView()).UTF8Encode().AsStringView()));
+ GetAttribute(expression.AsStringView()).ToUTF8().AsStringView()));
}
CJS_Result CJX_Node::getElement(
@@ -406,7 +406,7 @@
return;
}
pValue->SetString(
- TryNamespace().value_or(WideString()).UTF8Encode().AsStringView());
+ TryNamespace().value_or(WideString()).ToUTF8().AsStringView());
}
void CJX_Node::model(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 44ebcc9..c4520bf 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -165,13 +165,13 @@
}
bool CJX_Object::HasMethod(const WideString& func) const {
- return pdfium::ContainsKey(method_specs_, func.UTF8Encode());
+ return pdfium::ContainsKey(method_specs_, func.ToUTF8());
}
CJS_Result CJX_Object::RunMethod(
const WideString& func,
const std::vector<v8::Local<v8::Value>>& params) {
- auto it = method_specs_.find(func.UTF8Encode());
+ auto it = method_specs_.find(func.ToUTF8());
if (it == method_specs_.end())
return CJS_Result::Failure(JSMessage::kUnknownMethod);
@@ -204,7 +204,7 @@
void CJX_Object::ThrowException(const WideString& str) const {
ASSERT(!str.IsEmpty());
- FXJSE_ThrowMessage(str.UTF8Encode().AsStringView());
+ FXJSE_ThrowMessage(str.ToUTF8().AsStringView());
}
bool CJX_Object::HasAttribute(XFA_Attribute eAttr) {
@@ -1145,7 +1145,7 @@
bool bSetting,
XFA_Attribute eAttribute) {
if (!bSetting) {
- pValue->SetString(GetAttribute(eAttribute).UTF8Encode().AsStringView());
+ pValue->SetString(GetAttribute(eAttribute).ToUTF8().AsStringView());
return;
}
@@ -1278,7 +1278,7 @@
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
pValue->SetString(
- WideString::Format(L"%d,%d,%d", r, g, b).UTF8Encode().AsStringView());
+ WideString::Format(L"%d,%d,%d", r, g, b).ToUTF8().AsStringView());
}
void CJX_Object::Script_Som_BorderColor(CFXJSE_Value* pValue,
@@ -1309,7 +1309,7 @@
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
pValue->SetString(
- WideString::Format(L"%d,%d,%d", r, g, b).UTF8Encode().AsStringView());
+ WideString::Format(L"%d,%d,%d", r, g, b).ToUTF8().AsStringView());
}
void CJX_Object::Script_Som_BorderWidth(CFXJSE_Value* pValue,
@@ -1320,7 +1320,7 @@
CXFA_Edge* edge = border->GetEdgeIfExists(0);
CXFA_Measurement thickness =
edge ? edge->GetMSThickness() : CXFA_Measurement(0.5, XFA_Unit::Pt);
- pValue->SetString(thickness.ToString().UTF8Encode().AsStringView());
+ pValue->SetString(thickness.ToString().ToUTF8().AsStringView());
return;
}
@@ -1389,7 +1389,7 @@
default:
break;
}
- pValue->SetString(wsMessage.UTF8Encode().AsStringView());
+ pValue->SetString(wsMessage.ToUTF8().AsStringView());
}
void CJX_Object::Script_Som_ValidationMessage(CFXJSE_Value* pValue,
@@ -1489,7 +1489,7 @@
CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
} else {
- pValue->SetString(content.UTF8Encode().AsStringView());
+ pValue->SetString(content.ToUTF8().AsStringView());
}
}
@@ -1506,7 +1506,7 @@
pValue->SetNull();
return;
}
- pValue->SetString(content.UTF8Encode().AsStringView());
+ pValue->SetString(content.ToUTF8().AsStringView());
}
void CJX_Object::Script_Som_DataNode(CFXJSE_Value* pValue,
@@ -1541,7 +1541,7 @@
}
WideString str = CXFA_Node::AttributeEnumToName(validate->GetNullTest());
- pValue->SetString(str.UTF8Encode().AsStringView());
+ pValue->SetString(str.ToUTF8().AsStringView());
}
void CJX_Object::Script_Som_InstanceIndex(CFXJSE_Value* pValue,
@@ -1628,7 +1628,7 @@
}
Optional<WideString> checksum = TryAttribute(XFA_Attribute::Checksum, false);
- pValue->SetString(checksum ? checksum->UTF8Encode().AsStringView() : "");
+ pValue->SetString(checksum ? checksum->ToUTF8().AsStringView() : "");
}
void CJX_Object::Script_ExclGroup_ErrorText(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp
index 2f5f307..87d67de 100644
--- a/fxjs/xfa/cjx_packet.cpp
+++ b/fxjs/xfa/cjx_packet.cpp
@@ -41,7 +41,7 @@
attributeValue = element->GetAttribute(runtime->ToWideString(params[0]));
return CJS_Result::Success(
- runtime->NewString(attributeValue.UTF8Encode().AsStringView()));
+ runtime->NewString(attributeValue.ToUTF8().AsStringView()));
}
CJS_Result CJX_Packet::setAttribute(
@@ -94,5 +94,5 @@
if (element)
wsTextData = element->GetTextData();
- pValue->SetString(wsTextData.UTF8Encode().AsStringView());
+ pValue->SetString(wsTextData.ToUTF8().AsStringView());
}
diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp
index 2fd0957..9487bc1 100644
--- a/fxjs/xfa/cjx_subform.cpp
+++ b/fxjs/xfa/cjx_subform.cpp
@@ -90,7 +90,7 @@
}
WideString wsLocaleName = GetXFANode()->GetLocaleName().value_or(L"");
- pValue->SetString(wsLocaleName.UTF8Encode().AsStringView());
+ pValue->SetString(wsLocaleName.ToUTF8().AsStringView());
}
void CJX_Subform::instanceIndex(CFXJSE_Value* pValue,
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 5921f8b..c42355f 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -145,7 +145,7 @@
if (bSetting) {
WideString wsMessage = L"Unable to set ";
- FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringView());
+ FXJSE_ThrowMessage(wsMessage.ToUTF8().AsStringView());
return;
}
@@ -213,7 +213,7 @@
}
WideString wsSOMExpression = GetXFAObject()->GetSOMExpression();
- pValue->SetString(wsSOMExpression.UTF8Encode().AsStringView());
+ pValue->SetString(wsSOMExpression.ToUTF8().AsStringView());
}
void CJX_Tree::ResolveNodeList(CFXJSE_Value* pValue,
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 47da3b8..8438372 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -109,7 +109,7 @@
std::string GetPlatformString(FPDF_WIDESTRING wstr) {
WideString wide_string =
WideString::FromUTF16LE(wstr, WideString::WStringLength(wstr));
- return std::string(wide_string.UTF8Encode().c_str());
+ return std::string(wide_string.ToUTF8().c_str());
}
std::wstring GetPlatformWString(FPDF_WIDESTRING wstr) {
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 9a132b1..0a1d531 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -522,7 +522,7 @@
bool VerifyUnicodeForFontDescriptor(CFX_FontDescriptor* pDesc,
wchar_t wcUnicode) {
RetainPtr<IFX_SeekableReadStream> pFileRead =
- CreateFontStream(pDesc->m_wsFaceName.UTF8Encode());
+ CreateFontStream(pDesc->m_wsFaceName.ToUTF8());
if (!pFileRead)
return false;
@@ -715,7 +715,7 @@
return nullptr;
RetainPtr<IFX_SeekableReadStream> pFontStream =
- CreateFontStream(wsFaceName.UTF8Encode());
+ CreateFontStream(wsFaceName.ToUTF8());
if (!pFontStream)
return nullptr;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 0f2ee99..4c3f496 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -207,7 +207,7 @@
if (wsImage.GetLength() > 0) {
XFA_AttributeEnum iEncoding = pImage->GetTransferEncoding();
if (iEncoding == XFA_AttributeEnum::Base64) {
- ByteString bsData = wsImage.UTF8Encode();
+ ByteString bsData = wsImage.ToUTF8();
buffer.resize(bsData.GetLength());
int32_t iRead = XFA_Base64Decode(bsData.c_str(), buffer.data());
if (iRead > 0) {
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 613ddfb..c7bdb81 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -341,13 +341,13 @@
RegenerateFormFile_Changed(pNode, buf, bSaveXML);
size_t nLen = buf.GetLength();
if (nLen > 0)
- pStream->WriteString(buf.MakeString().UTF8Encode().AsStringView());
+ pStream->WriteString(buf.MakeString().ToUTF8().AsStringView());
return;
}
WideString wsElement(pNode->GetClassName());
pStream->WriteString("<");
- pStream->WriteString(wsElement.UTF8Encode().AsStringView());
+ pStream->WriteString(wsElement.ToUTF8().AsStringView());
WideString wsOutput;
SaveAttribute(pNode, XFA_Attribute::Name, L"name", true, wsOutput);
@@ -366,7 +366,7 @@
}
if (!wsOutput.IsEmpty())
- pStream->WriteString(wsOutput.UTF8Encode().AsStringView());
+ pStream->WriteString(wsOutput.ToUTF8().AsStringView());
CXFA_Node* pChildNode = pNode->GetFirstChild();
if (!pChildNode) {
@@ -380,7 +380,7 @@
pChildNode = pChildNode->GetNextSibling();
}
pStream->WriteString("</");
- pStream->WriteString(wsElement.UTF8Encode().AsStringView());
+ pStream->WriteString(wsElement.ToUTF8().AsStringView());
pStream->WriteString(">\n");
}
@@ -518,7 +518,7 @@
wsVersionNumber = L"2.8";
wsVersionNumber += L"/\"\n>";
- pStream->WriteString(wsVersionNumber.UTF8Encode().AsStringView());
+ pStream->WriteString(wsVersionNumber.ToUTF8().AsStringView());
CXFA_Node* pChildNode = pNode->GetFirstChild();
while (pChildNode) {