FreeBSD Bugzilla – Attachment 203095 Details for
Bug 236397
www/newsboat: Bad display from an atom source
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposition for utils::clean_nonprintable_characters()
patch-src_utils.cpp (text/plain), 1.41 KB, created by
moebius444
on 2019-03-24 05:36:54 UTC
(
hide
)
Description:
Proposition for utils::clean_nonprintable_characters()
Filename:
MIME Type:
Creator:
moebius444
Created:
2019-03-24 05:36:54 UTC
Size:
1.41 KB
patch
obsolete
>--- src/utils.cpp.orig 2019-02-10 16:07:09 UTC >+++ src/utils.cpp >@@ -27,6 +27,10 @@ > #include <unistd.h> > #include <unordered_set> > >+#include <cwchar> >+#include <sstream> >+#include <iomanip> >+ > #include "3rd-party/alphanum.hpp" > #include "config.h" > #include "logger.h" >@@ -521,9 +525,15 @@ std::wstring utils::utf8str2wstr(const std::string& ut > std::wstring utils::str2wstr(const std::string& str) > { > const char* codeset = nl_langinfo(CODESET); >+ >+ //LOG(Level::DEBUG,"str2wstr, codeset=%s", codeset); >+ > struct stfl_ipool* ipool = stfl_ipool_create(codeset); > std::wstring result = stfl_ipool_towc(ipool, str.c_str()); > stfl_ipool_destroy(ipool); >+ >+ LOG(Level::DEBUG, "str2wstr, str=%s", str.c_str()); >+ > return result; > } > >@@ -534,6 +544,9 @@ std::string utils::wstr2str(const std::wstring& wstr) > struct stfl_ipool* ipool = stfl_ipool_create(codeset.c_str()); > std::string result = stfl_ipool_fromwc(ipool, wstr.c_str()); > stfl_ipool_destroy(ipool); >+ >+ LOG(Level::DEBUG, "wstr2str, codeset=%s, str=%s", codeset.c_str(), result.c_str()); >+ > return result; > } > >@@ -992,7 +1005,9 @@ std::string utils::unescape_url(const std::string& url > std::wstring utils::clean_nonprintable_characters(std::wstring text) > { > for (size_t idx = 0; idx < text.size(); ++idx) { >- if (!iswprint(text[idx])) >+ if (text[idx] == L'\u00A0') >+ text[idx] = L'\u0020'; >+ else if (!iswprint(text[idx])) > text[idx] = L'\uFFFD'; > } > return text;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 236397
: 203095