Skip to content

Recode with ISO-8859-2 input specified calls iconv with CP912, unsupported by libiconv #65

@oreo639

Description

@oreo639

While running the enca tests with recode 3.7.15 with libiconv, I noticed a test failure in test-recode.sh.

enca: librecode probably damaged `STDIN'. No way to recover in a pipe.
1d0
< nápor po»ouchlých Ÿlutých èíòanù pøehlu¹il i zuøící orkán
FAIL test-recode.sh (exit status: 1)

Running ../src/enca -L cs -C librecode -x UTF-8 <test-recode.actual >test-recode.tmp with verbose:

Adding converter `librecode'
Explicitly specified target charset: UTF-8
Initializing language cs
enca: converting `STDIN': ISO-8859-2..UTF-8
    trying to convert `STDIN' using librecode

Upon further investigation, I found that ISO-8859-2 was being transformed into CP912 and passed to libiconv (this happens with both libiconv and glibc iconv, although glibc defines it as an alias in the /usr/lib/gconv/gconv-modules config file).

There is code for defining CP912 as an alias for ISO-8859-2 in strip-data.c (generated from tables.py), not sure why that doesn't seem to be working here?
https://github.com/rrthomas/recode/blob/f49992e71463ad9f8ee543ce357af80fc99d23c1/tables.py

(gdb) run -VVVV -L cs -C librecode -x UTF-8 <test-recode.actual >test-recode.tmp
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/home/oreo639/git/IPR/void-packages/masterdir-x86_64/builddir/enca-1.19/src/.libs/enca' has changed; re-reading symbols.
Starting program: /home/oreo639/git/IPR/void-packages/masterdir-x86_64/builddir/enca-1.19/src/.libs/enca -VVVV -L cs -C librecode -x UTF-8 <test-recode.actual >test-recode.tmp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Adding converter `librecode'
Explicitly specified target charset: UTF-8
Initializing language cs
enca: converting `STDIN': ISO-8859-2..UTF-8
    trying to convert `STDIN' using librecode
encreq: ISO-8859-2/..UTF-8

Breakpoint 2, recode_scan_request (request=0x55555564dcb0, 
    string=0x55555564dc90 "ISO-8859-2/..UTF-8") at ./src/request.c:1156
warning: 1156	./src/request.c: No such file or directory
(gdb) c
Continuing.

Breakpoint 1, libiconv_open (tocode=tocode@entry=0x55555556afb0 "UTF-8", 
    fromcode=0x7ffff7f2a62c "CP912") at ./iconv.c:235
warning: 235	./iconv.c: No such file or directory
(gdb) bt
#0  libiconv_open (tocode=tocode@entry=0x55555556afb0 "UTF-8", 
    fromcode=0x7ffff7f2a62c "CP912") at ./iconv.c:235
#1  0x00007ffff7eeab9a in recode_transform_with_iconv (subtask=0x7fffffffe0d0)
    at ./src/iconv.c:219
#2  0x00007ffff7ef11dd in recode_perform_task (task=0x55555564dd40)
    at ./src/task.c:396
#3  0x000055555555ae12 in convert_recode ()
#4  0x000055555555a459 in convert ()
#5  0x000055555555b8d1 in process_file ()
#6  0x0000555555559724 in main ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions