From fd7cede17e027a83de2aff3bc0f5ee875271e444 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 9 Aug 2018 21:32:47 +0000 Subject: Move all utf8 decoding under fx_string.h Put encoder in cfx_utf8encoder.{h,cpp} to parallel decoder. Add tests, and fix one corner case involving 0xff. Change-Id: Ib97540afdc708bcc6280a79c76734ec68ea72690 Reviewed-on: https://pdfium-review.googlesource.com/39770 Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang --- core/fxcrt/widestring.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'core/fxcrt/widestring.cpp') diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index 97073f170d..e3c08d72e1 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp @@ -12,7 +12,6 @@ #include #include -#include "core/fxcrt/cfx_utf8decoder.h" #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" @@ -885,14 +884,7 @@ WideString WideString::FromLocal(const ByteStringView& bstr) { // static WideString WideString::FromUTF8(const ByteStringView& str) { - if (str.IsEmpty()) - return WideString(); - - CFX_UTF8Decoder decoder; - for (size_t i = 0; i < str.GetLength(); i++) - decoder.Input(str[i]); - - return WideString(decoder.GetResult()); + return FX_UTF8Decode(str); } // static -- cgit v1.2.3