From eb12d13f5933ee62917ace1178ffafd7d0ee2b3a Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sun, 16 May 2010 12:52:14 +0000 Subject: [PATCH] + printStringInHexadecimal() for debugging purpose --- src/common/unaccent.cpp | 12 ++++++++++++ src/common/unaccent.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/common/unaccent.cpp b/src/common/unaccent.cpp index b025ef361..516f8abcd 100644 --- a/src/common/unaccent.cpp +++ b/src/common/unaccent.cpp @@ -66,3 +66,15 @@ std::string &removeAccents(std::string &text) { unicodeAccentedString.toUTF8String(text); return text; } + +void printStringInHexadecimal(const char *s) { + std::cout << std::showbase << std::hex; + for (char const* pc = s; *pc; ++pc) { + if (*pc & 0x80) + std::cout << (*pc & 0xff); + else + std::cout << *pc; + std::cout << ' '; + } + std::cout << std::endl; +} diff --git a/src/common/unaccent.h b/src/common/unaccent.h index 7c20ac36a..66d9188ee 100644 --- a/src/common/unaccent.h +++ b/src/common/unaccent.h @@ -95,3 +95,4 @@ private: }; std::string &removeAccents(std::string &text); +void printStringInHexadecimal(const char *s);