Avoid UNSAFE_TODO when making wide strings from C-style binary arrays.

Follow-on from
  https://pdfium-review.googlesource.com/c/pdfium/+/121890

but applies to multi-byte strings.

Change-Id: I636cf863f511dc145a2d414619cce41aded3f6de
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121872
Reviewed-by: Tom Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 3505cc7..26ac6a3 100644
--- a/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -43,7 +43,7 @@
   wchar_t cw[2];
   cw[0] = static_cast<wchar_t>(v / 256);
   cw[1] = static_cast<wchar_t>(v % 256);
-  return UNSAFE_TODO(WideString(cw, std::size(cw)));
+  return WideString(WideStringView(pdfium::make_span(cw)));
 }
 
 }  // namespace
diff --git a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
index 4ac65e2..616f394 100644
--- a/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_EdifactEncoder.cpp
@@ -48,7 +48,8 @@
   cw[1] = static_cast<wchar_t>((v >> 8) & 255);
   cw[2] = static_cast<wchar_t>(v & 255);
   // TODO(tsepez): stop putting binary data in strings.
-  return UNSAFE_TODO(WideString(cw, std::min(len, kBuflen)));
+  return WideString(
+      WideStringView(pdfium::make_span(cw).first(std::min(len, kBuflen))));
 }
 
 bool HandleEOD(CBC_EncoderContext* context, const WideString& buffer) {