Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
html2text
html2text-debian-630_recode_output_to_locale_ch...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File html2text-debian-630_recode_output_to_locale_charset.patch of Package html2text
Convert output to user's locale charset. Index: html2text-1.3.2a/html2text.C =================================================================== --- html2text-1.3.2a.orig/html2text.C 2008-09-20 14:09:32.009308515 +0300 +++ html2text-1.3.2a/html2text.C 2008-09-20 14:09:40.133207014 +0300 @@ -45,6 +45,7 @@ #include <iconv.h> #include <errno.h> +#include <langinfo.h> #include "html.h" #include "HTMLControl.h" @@ -59,6 +60,7 @@ using std::stringstream; using std::istream_iterator; using std::ostream_iterator; +using std::noskipws; class MyParser : public HTMLControl { @@ -474,7 +476,7 @@ uis = infile; } - *uis >> std::noskipws; + *uis >> noskipws; std::copy(istream_iterator<char>(*uis), istream_iterator<char>(), ostream_iterator<char>(input_stream)); if (infile) @@ -547,6 +549,8 @@ // real parsing now always process UTF-8 use_encoding = UTF8; + stringstream output_stream; + // real parsing input_stream.clear(); input_stream.seekg(0); @@ -554,13 +558,28 @@ input_stream, debug_scanner, debug_parser, - *osp, + output_stream, mode, width, input_url ); if (parser.yyparse() != 0) exit(1); + // recode output + setlocale(LC_CTYPE,""); + char output_encoding[64]; + strcpy(output_encoding, nl_langinfo(CODESET)); + strcat(output_encoding, "//translit"); + + result = recode(output_stream, output_encoding, "UTF-8"); + if (!result) + { + continue; + } + output_stream.clear(); + output_stream.seekg(0); + output_stream >> noskipws; + std::copy(istream_iterator<char>(output_stream), istream_iterator<char>(), ostream_iterator<char>(*osp)); } return 0;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor