PDF Output: Fix regression in previous release causing non-ascii entries to be incorrectly encoded into the PDF bookmarks

This commit is contained in:
Kovid Goyal 2023-05-28 09:27:03 +05:30
parent 59503c21dc
commit 00681544d8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -8,6 +8,7 @@
#include "global.h"
#include <sstream>
#include <stdexcept>
#include <string_view>
using namespace pdf;
@ -33,5 +34,5 @@ pdf::podofo_convert_pystring(PyObject *val) {
Py_ssize_t len;
const char *data = PyUnicode_AsUTF8AndSize(val, &len);
if (data == NULL) throw std::runtime_error("Failed to convert python string to UTF-8, possibly not a string object");
return PdfString::FromRaw(bufferview(data, len));
return PdfString(std::string_view(data, len));
}