bgarrigues pushed a commit to branch master
in repository groff.
commit c30821d767974c0a5e7220c0e5a65dc963785dc5
Author: Bertrand Garrigues <[email protected]>
AuthorDate: Sun Oct 18 00:53:32 2020 +0200
preconv: don't use libuchardet if input is stdin
* src/preproc/preconv/preconv.cpp (do_file): don't call
detect_file_encoding if input file is "-"
This fixes the failure on MS-Windows described #55334, however this
does not fix the encoding detection with uchardet if the input is
stdin (the user would have to pass with -D the correct encoding as
explained in the man page).
---
ChangeLog | 12 ++++++++++++
src/preproc/preconv/preconv.cpp | 4 +++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 9eb2115..5b70e0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2020-10-18 Bertrand Garrigues <[email protected]>
+
+ preconv: don't use libuchardet if input is stdin
+
+ * src/preproc/preconv/preconv.cpp (do_file): don't call
+ detect_file_encoding if input file is "-"
+
+ This fixes the failure on MS-Windows described #55334, however this
+ does not fix the encoding detection with uchardet if the input is
+ stdin (the user would have to pass with -D the correct encoding as
+ explained in the man page).
+
2020-10-17 G. Branden Robinson <[email protected]>
* src/preproc/eqn/lex.cpp (troff_defs): Set the "..." token on
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 62c0f4d..e9ca534 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -1078,6 +1078,7 @@ do_file(const char *filename)
{
FILE *fp;
string BOM, data;
+
if (strcmp(filename, "-")) {
if (debug_flag)
fprintf(stderr, "file '%s':\n", filename);
@@ -1119,7 +1120,8 @@ do_file(const char *filename)
if (!file_encoding) {
if (debug_flag)
fprintf(stderr, " no coding tag\n");
- file_encoding = detect_file_encoding(fp);
+ if (strcmp(filename, "-"))
+ file_encoding = detect_file_encoding(fp);
if (!file_encoding) {
if (debug_flag)
fprintf(stderr, " could not detect encoding with uchardet\n");
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit