mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PDF Output: Fix regression in previous release causing non-ascii entries to be incorrectly encoded into the PDF bookmarks
This commit is contained in:
parent
59503c21dc
commit
00681544d8
@ -8,6 +8,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
using namespace pdf;
|
using namespace pdf;
|
||||||
|
|
||||||
@ -33,5 +34,5 @@ pdf::podofo_convert_pystring(PyObject *val) {
|
|||||||
Py_ssize_t len;
|
Py_ssize_t len;
|
||||||
const char *data = PyUnicode_AsUTF8AndSize(val, &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");
|
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));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user