Fixed multibyte string encoding#128
Conversation
87d737b to
6be60b2
Compare
|
@edgardmessias please provide covered test case |
|
I think it's a lot better to use only maintainers need to say their word on that. |
|
also, I think you must specify how does it even work for you? you say your encoding is "Chinese" (which one of them? Big5? ISO 2022-JP?. ...?), but then write code that assumes utf-8? in the bug report, you complain that the existing code doesn't respect multibyte, but then you add a function that relies on autodetect or unknown default? |
|
Looking here the dependencies, the |
|
great, then you only need to ensure the proper version is used:
|
4b20ec7 to
62e782f
Compare
|
@glensc , I made a full rework |
|
Add test where -filename=\"$multibyteFilename\""
+filename=$multibyteFilenameare using single quotes also allowed there? |
62e782f to
a58790b
Compare
I think this is a discussion for another topic. I solved the problems mentioned above |
|
Some other notes.
|
I'm not certain of that, as your new code assumes an exact match of |
|
@glensc First, thanks for the tips. About the quote, I not modified the parser function (lines 43-95), but the encoder function ( The problem with |
|
@edgardmessias alright, I had a really quick look on the diff only, so didn't look it closely it's a generator, not parser logic. |
| ['filename' => 'this-file-name-is-so-long-that-it-does-not-even-fit-on-a-whole-line-by-itself-so-we-need-to-split-it-with-value-continuation.also-UTF-8-characters-hērē.txt'], | ||
| "attachment;\r\n filename*0=\"this-file-name-is-so-long-that-it-does-not-even-fit-on-a-\";\r\n filename*1=\"whole-line-by-itself-so-we-need-to-split-it-with-value-co\";\r\n filename*2=\"ntinuation.also-UTF-8-characters-hērē.txt\"", | ||
| "Content-Disposition: attachment;\r\n filename*0=\"=?UTF-8?Q?this-file-name-is-so-long-that-it-does-not-ev?=\";\r\n filename*1=\"=?UTF-8?Q?en-fit-on-a-whole-line-by-itself-so-we-need-t?=\";\r\n filename*2=\"=?UTF-8?Q?o-split-it-with-value-continuation.also-UTF-8?=\";\r\n filename*3=\"=?UTF-8?Q?-characters-h=C4=93r=C4=93.txt?=\"", | ||
| "attachment;\r\n filename*0=\"this-file-name-is-so-long-that-it-does-not-even-fit-on-a-whole-\";\r\n filename*1=\"line-by-itself-so-we-need-to-split-it-with-value-continuation.a\";\r\n filename*2=\"lso-UTF-8-characters-hērē.txt\"", |
There was a problem hiding this comment.
Some byte-level changes happened here: should be investigated (these two lines, specifically)
There was a problem hiding this comment.
Yes, because I edited the function to generate exactly size of 78 characters
|
I reviewed changes and tests cases and all seems ok form me. Indeed, now filenames that are not using multibytes strings are now splitted on lines that are 78 chars length (instead of fickle value based on |
ece12a0 to
35e0828
Compare
35e0828 to
a58790b
Compare
Related to glpi-project/glpi#8495 Signed-off-by: Edgard <edgardmessias@gmail.com>
a58790b to
dd51ff2
Compare
Description
The problem occurs when the filename is multibyte string and this needs continuation.
str_splitdon't work with multibyte strings, like chineses characteres.Related to glpi-project/glpi#8495