summaryrefslogtreecommitdiffstats
path: root/chrome/common/libxml_utils.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 20:46:41 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 20:46:41 +0000
commit9c99d1ce15520712578e2b7e9102c909e4ab379c (patch)
treeefcdc298a344ed2e3066f1a5ae8892fd3be57db6 /chrome/common/libxml_utils.cc
parent621d3577a29ed53a00ae94fd8f79aa1f16b15669 (diff)
downloadchromium_src-9c99d1ce15520712578e2b7e9102c909e4ab379c.zip
chromium_src-9c99d1ce15520712578e2b7e9102c909e4ab379c.tar.gz
chromium_src-9c99d1ce15520712578e2b7e9102c909e4ab379c.tar.bz2
wstring: use FilePath instead of std::string for a path
BUG=69467 TEST=compiles Review URL: http://codereview.chromium.org/6347047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/libxml_utils.cc')
-rw-r--r--chrome/common/libxml_utils.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/chrome/common/libxml_utils.cc b/chrome/common/libxml_utils.cc
index 009f0d3..61d4237 100644
--- a/chrome/common/libxml_utils.cc
+++ b/chrome/common/libxml_utils.cc
@@ -5,8 +5,10 @@
#include "chrome/common/libxml_utils.h"
#include "base/compiler_specific.h"
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/stringprintf.h"
+#include "base/utf_string_conversions.h"
#include "libxml/xmlreader.h"
@@ -49,11 +51,19 @@ bool XmlReader::Load(const std::string& input) {
return reader_ != NULL;
}
-bool XmlReader::LoadFile(const std::string& file_path) {
-
+bool XmlReader::LoadFile(const FilePath& file_path) {
const int kParseOptions = XML_PARSE_RECOVER | // recover on errors
XML_PARSE_NONET; // forbid network access
- reader_ = xmlReaderForFile(file_path.c_str(), NULL, kParseOptions);
+ reader_ = xmlReaderForFile(
+#if defined(OS_WIN)
+ // libxml takes UTF-8 paths on Windows; search the source for
+ // xmlWrapOpenUtf8 to see it converting UTF-8 back to wide
+ // characters.
+ WideToUTF8(file_path.value()).c_str(),
+#else
+ file_path.value().c_str(),
+#endif
+ NULL, kParseOptions);
return reader_ != NULL;
}