summaryrefslogtreecommitdiff
path: root/libs/ardour/export_handler.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-01-24 01:03:42 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-01-24 01:03:42 +0000
commitd0ef18e94e107914f55de218889088f928faff3a (patch)
tree6f8df3e005925782450be8e8c47de621d4ca47a6 /libs/ardour/export_handler.cc
parent6918bba1708242ce0c06a37a6e97ab10a3e8d044 (diff)
improved fix for TOC string escaping, handle anything that can be converted from UTF-8 to Latin-1
git-svn-id: svn://localhost/ardour2/branches/3.0@11323 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_handler.cc')
-rw-r--r--libs/ardour/export_handler.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index c683084ae9..0b1243afd2 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -599,15 +599,18 @@ ExportHandler::cd_marker_file_escape_string (const std::string& txt)
{
Glib::ustring check (txt);
std::string out;
+ std::string latin1_txt;
char buf[5];
- if (!check.is_ascii()) {
+ try {
+ latin1_txt = Glib::convert (txt, "ISO-8859-1", "UTF-8");
+ } catch (...) {
throw Glib::ConvertError (Glib::ConvertError::NO_CONVERSION, string_compose (_("Cannot convert %1 to Latin-1 text"), txt));
}
out = '"';
- for (std::string::const_iterator c = txt.begin(); c != txt.end(); ++c) {
+ for (std::string::const_iterator c = latin1_txt.begin(); c != latin1_txt.end(); ++c) {
if ((*c) == '"') {
out += "\\\"";
@@ -616,7 +619,7 @@ ExportHandler::cd_marker_file_escape_string (const std::string& txt)
} else if (isprint (*c)) {
out += *c;
} else {
- snprintf (buf, sizeof (buf), "\\%03o", *c);
+ snprintf (buf, sizeof (buf), "\\%03o", (int) (unsigned char) *c);
out += buf;
}
}