lib/iconv_open2.h

Branch


Log

Author Commit Date CI Message
Bruno Haible 9f28054d 2024-12-15T12:52:18 Implement the //NON_IDENTICAL_DISCARD suffix from POSIX:2024. * include/iconv.h.in (ICONV_GET_DISCARD_INVALID, ICONV_SET_DISCARD_INVALID, ICONV_GET_DISCARD_NON_IDENTICAL, ICONV_SET_DISCARD_NON_IDENTICAL): New macros. * lib/converters.h (struct conv_struct): Change type of discard_ilseq to 'unsigned int'. (DISCARD_INVALID, DISCARD_UNCONVERTIBLE): New macros. * lib/iconv.c (iconv_open, iconv_open_into): Change type of discard_ilseq to 'unsigned int'. (iconvctl): Implement ICONV_GET_DISCARD_INVALID, ICONV_SET_DISCARD_INVALID, ICONV_GET_DISCARD_NON_IDENTICAL, ICONV_SET_DISCARD_NON_IDENTICAL. Change the implementation of ICONV_GET_DISCARD_ILSEQ, ICONV_SET_DISCARD_ILSEQ to test/set both bits. * lib/iconv_open1.h: Update comment. Recognize //NON_IDENTICAL_DISCARD. * lib/iconv_open2.h: Update comment. * lib/loop_unicode.h (mb_to_uc_write_replacement): Test the DISCARD_UNCONVERTIBLE bit of discard_ilseq. (unicode_loop_convert): Test the respective bit of discard_ilseq. (unicode_loop_reset): Test the DISCARD_UNCONVERTIBLE bit of discard_ilseq. * lib/loop_wchar.h (wchar_from_loop_convert, wchar_to_loop_convert): Test the DISCARD_INVALID bit of discard_ilseq. * man/iconv_open.3: Mention the //NON_IDENTICAL_DISCARD suffix. Mark as conforming to POSIX:2024. * man/iconv.3: Likewise. * man/iconv_close.3: Mark as conforming to POSIX:2024. * man/iconv.1: Likewise. * man/iconvctl.3: Document ICONV_GET_DISCARD_INVALID, ICONV_SET_DISCARD_INVALID, ICONV_GET_DISCARD_NON_IDENTICAL, ICONV_SET_DISCARD_NON_IDENTICAL. Revise the description of ICONV_GET_DISCARD_ILSEQ, ICONV_SET_DISCARD_ILSEQ. * tests/test-discard.c (test_default, test_translit, test_ignore, test_ignore_translit): Test also the ICONV_GET_DISCARD_INVALID, ICONV_GET_DISCARD_NON_IDENTICAL accessors. (test_nid, test_nid_translit, test_invd, test_invd_translit): New functions. (main): Add test cases with //NON_IDENTICAL_DISCARD suffix. * NEWS: Mention the change.
Bruno Haible e310efbf 2024-12-14T17:00:22 Remove left-overs of preloadable library (removed in 1.16). * include/iconv.h.in: Remove LIBICONV_PLUG conditionals. * lib/iconv.c: Likewise. * lib/converters.h: Likewise. * lib/loop_unicode.h: Likewise. * lib/loop_wchar.h: Likewise. * lib/iconv_open2.h: Likewise.
Bruno Haible a4c1470b 2024-12-13T23:55:13 Distinguish byte-order state and shift-state. Reported by Tomas Kalibera <tomas.kalibera@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnu-libiconv/2024-12/msg00000.html>. * lib/converters.h (struct conv_struct): Add field 'ibyteorder'. * lib/iconv_open2.h: Initialize the ibyteorder field. * lib/ucs2.h (ucs2_mbtowc): Use the ibyteorder field instead of the istate field. * lib/ucs4.h (ucs4_mbtowc): Likewise. * lib/utf16.h (utf16_mbtowc): Likewise. * lib/utf32.h (utf32_mbtowc): Likewise. * tests/test-bom-state.c: New file. * tests/Makefile.in (check): Run test-bom-state. (test-bom-state, test-bom-state.@OBJEXT@): New targets. (clean): Remove test-bom-state. (SOURCE_FILES): Add test-bom-state.c. * NEWS: Mention the change.
Bruno Haible 19b6af5e 2023-04-03T04:12:01 Allow overriding the newline conversion for EBCDIC encodings. Reported by Mike Fulton <mikefultonpersonal@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnu-libiconv/2023-04/msg00009.html>. * include/iconv.h.in (ICONV_SURFACE_NONE, ICONV_SURFACE_EBCDIC_ZOS_UNIX): New macros. (ICONV_GET_FROM_SURFACE, ICONV_SET_FROM_SURFACE, ICONV_GET_TO_SURFACE, ICONV_SET_TO_SURFACE): New macros. * lib/converters.h (struct conv_struct): Add the fields isurface, osurface. (swap_x15_x25): New macro. * lib/iconv.c (iconv_open, iconv_open_into): Add local variables from_surface, to_surface. (ALL_SURFACES): New macro. (iconvctl): Adjust ICONV_TRIVIALP implementation. Implement the ICONV_{GET,SET}_{FROM,TO}_SURFACE requests. * lib/iconv_open1.h: Parse a /ZOS_UNIX surface specifier. Set from_surface, to_surface. * lib/iconv_open2.h: Copy the values of from_surface, to_surface into the conversion descriptor. * lib/ebcdic*.h (*_mbtowc): Test the isurface. If requested, call swap_x15_x25 right after fetching an input byte. (*_wctomb): Test the osurface. If requested, call swap_x15_x25 right before storing an output byte. * man/iconvctl.3 (REQUEST VALUES): Document the ICONV_{GET,SET}_{FROM,TO}_SURFACE requests. * src/iconv.c (main): If ICONV_EBCDIC_ZOS_UNIX is set, set the from/to surfaces accordingly. * man/iconv.1 (ENVIRONMENT): New section. * tests/check-ebcdic: New file. * tests/Makefile.in (check): Invoke it. (SOURCE_FILES): Add it. * NEWS: Mention the new functionality.
Bruno Haible 91f96be0 2021-06-06T11:51:12 Change the license of the library from LGPL 2.0 to LGPL 2.1.
Bruno Haible 3acb1179 2020-04-04T14:58:34 Change the license of the library from LGPL 2.0 to LGPL 2.1.
Bruno Haible e54fc9c1 2018-09-17T18:28:56 Prefer https URLs where possible.
Bruno Haible 48f31c74 2012-02-12T20:54:51 Replace FSF snail-mail address with URL.
Bruno Haible 6d4efe5e 2009-04-24T23:51:49 Fix a compilation error on HP-UX 11.00, introduced on 2008-09-16.
Bruno Haible 10cf0ccd 2008-09-17T01:08:01 Part 2 of iconv_open().