lib/iconv.c

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 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 68ac8a9f 2022-01-23T23:37:30 New EBCDIC encodings. Reported by Ulrich Schwab and Calvin Buckley via Jack Woehr. * NOTES: Mention how to enable EBCDIC encodings. * tests/IBM-*.TXT: New files. * tools/8bit_tab_to_h.c (main): Emit copyright header with year 2022. * tools/Makefile: Add rules for generating ebcdic*.h. * lib/ebcdic*.h: New files, automatically generated by tools/Makefile. * lib/ebcdic838.h: Tweak reverse mapping manually. * lib/ebcdic1160.h: Likewise. * lib/converters.h: Include all ebcdic*.h. * lib/encodings_zos.def: New file. * lib/genaliases2.c: Include encodings_zos.def. * lib/genflags.c: Likewise. * Makefile.devel (lib/aliases_zos.h lib/canonical_zos.h): New rule. (lib/flags.h, totally-clean): Update. * lib/aliases2.h: Include aliases_zos.h. * lib/iconv.c (USE_ZOS): New macro. Include encodings_zos.def, canonical_zos.h. * README, man/iconv_open.3: Document the IBM-* encodings. * tests/Makefile.in (check-extra-yes): Also test the EBCDIC encodings.
Bruno Haible 91f96be0 2021-06-06T11:51:12 Change the license of the library from LGPL 2.0 to LGPL 2.1.
Bruno Haible 0eb1068c 2020-08-31T23:43:18 Fix some -Wcast-qual warning, reported by clang.
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 35064ed9 2018-05-04T21:27:39 Simplify code. Drop support for Borland C++ on Windows.
Bruno Haible b29089d8 2016-11-19T17:13:56 Fix link error when compiling with gcc -O0.
Bruno Haible 40924a62 2016-10-14T03:18:05 Use 'size_t', not 'int', for the length of a string.
Bruno Haible 48f31c74 2012-02-12T20:54:51 Replace FSF snail-mail address with URL.
Bruno Haible 3cdff14a 2011-01-29T18:34:14 Simplify "wchar_t" handling on Cygwin 1.7.x.
Bruno Haible c38bdb4f 2011-01-29T18:24:44 Adjust the meaning of "wchar_t" on native Windows systems.
Bruno Haible 607294d2 2008-09-17T01:08:35 New function iconv_open_into.
Bruno Haible bcb1081e 2008-04-06T07:38:02 Support system-dependent aliases.
Bruno Haible a446ed6b 2007-04-23T21:57:37 Exploit the fact that wchar_t on native Woe32 is Unicode.
Bruno Haible 422b3b1d 2006-01-23T13:25:49 New feature: character-dependent substitutions.
Bruno Haible 45bd190c 2005-05-19T17:14:19 Update FSF postal address.
Bruno Haible 1f180ad5 2005-03-16T12:19:06 Accept //TRANSLIT//IGNORE as synonymous to //IGNORE//TRANSLIT also in function iconv_canonicalize.
Bruno Haible 8489f6de 2005-03-14T11:27:00 New function iconv_canonicalize.
Bruno Haible 719d85b4 2005-03-14T11:24:40 Introduce iconv_hooks.
Bruno Haible 3d0c9858 2004-11-11T15:36:38 Oops.
Bruno Haible 48535df2 2004-11-11T15:34:18 Accept //TRANSLIT//IGNORE as synonymous to //IGNORE//TRANSLIT.
Bruno Haible 294602d6 2003-05-22T19:17:48 Convert the string tables to position-independent code.
Bruno Haible c1e5bb48 2003-05-20T11:56:06 Fix a null pointer access in "iconv -l".
Bruno Haible 411b8e57 2003-04-24T10:49:10 Better support for FreeBSD.
Bruno Haible 2929676c 2003-04-25T10:18:03 Add support for VMS.
Bruno Haible 64d5a8b9 2003-03-29T16:35:11 Improved MSVC support.
Bruno Haible ca7aa552 2002-05-16T12:01:34 New configure option --enable-extra-encodings. Add the extra encodings and the platform dependent encodings to the testsuite.
Bruno Haible 5ab9f909 2002-05-08T19:37:48 Enable DOS encodings also on Woe32. Suggested by Perry Rapp.
Bruno Haible d82b82d2 2002-01-14T12:05:04 Support for "iconv -l".
Bruno Haible 1d7b650c 2001-12-06T14:27:22 Empty encoding name is equivalent to locale dependent encoding, as in glibc.
Bruno Haible 4f99b68d 2002-01-15T12:47:34 Support for "iconv -c".
Bruno Haible 19bb4fef 2001-05-26T00:31:46 The multibyte to Unicode conversion may now be stateful. Add Unicode normalization to multibyte to Unicode direction for CP1255, CP1258, TCVN.
Bruno Haible 65068c48 2001-03-27T13:35:32 Update copyright notice.
Bruno Haible 8c5fb204 2001-03-06T13:43:56 Add support for OSF/1 (Tru64) 5.1.
Bruno Haible dbd0052d 2001-02-26T13:42:01 locale_charset() doesn't return NULL any more.
Bruno Haible 3d31606d 2001-02-26T13:36:17 Add support for DOS encodings.
Bruno Haible 58849cb5 2000-12-01T20:10:31 Define the version number in the library as well.
Bruno Haible a615528b 2000-11-23T19:54:07 Move src/ to lib/, and install the iconv program.