[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnu-libiconv] Libiconv iconv_string(...) cannot ignore incorrect pa
From: |
1 1 |
Subject: |
[bug-gnu-libiconv] Libiconv iconv_string(...) cannot ignore incorrect parts |
Date: |
Sun, 2 Apr 2023 07:05:57 +0000 |
Dear Sir or Madam <bug-gnu-libiconv@gnu.org>
Hello,
I would like to provide some suggestions regarding my usage of the function
iconv_string in programming. It has come to my attention that this function is
unable to handle certain parts of a multi-byte string that contains errors.
Oftentimes, there may be a segment of garbled characters within a string that
requires ignore, causing iconv_string to be unable to handle the correct parts
of the string.
To address this issue, my suggestion is to modify the function to include an
ignore errors feature. Specifically, I propose the following changes:
```
/*
If the boolean parameter "strict" is set to 1, input errors will be handled in
a strict manner. If an error is encountered, encoding will stop immediately and
return an error code.
If the boolean parameter "strict" is set to 0, input errors will be handled in
a relaxed manner. If an error is encountered, it will be skipped over and the
return value will always be 0.
*/
int iconv_string (const char* tocode, const char* fromcode,
const char* start, const char* end,
char** resultp, size_t* lengthp,
bool strict);
```
To avoid compilation errors for older programs that use iconv_string, I suggest
make a new function "iconv_string_extend". These changes would not only address
the issue that I have encountered, but also enhance the compatibility and
expandability of the program.
Like this:
```
int iconv_string (const char* tocode, const char* fromcode,
const char* start, const char* end,
char** resultp, size_t* lengthp);
int iconv_string_extend (const char* tocode, const char* fromcode,
const char* start, const char* end,
char** resultp, size_t* lengthp,
bool strict);
```
That is all, thank you.
I am weak in English. If there are some mistakes in this email, please ignore
it :)
Yours ChenPi11 <wushengwuxi-msctinoulk@outlook.com>
2023/4/2
- [bug-gnu-libiconv] Libiconv iconv_string(...) cannot ignore incorrect parts,
1 1 <=