From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Lukas Wagner <l.wagner@proxmox.com>
Subject: [pve-devel] applied-series: [PATCH common/cluster 0/3] fix #4937: fix utf8 encoding issues while saving notification config
Date: Mon, 11 Sep 2023 14:50:20 +0200 [thread overview]
Message-ID: <d7c21cbe-afff-22e9-7878-c427d093958b@proxmox.com> (raw)
In-Reply-To: <20230830123754.606260-1-l.wagner@proxmox.com>
Am 30.08.23 um 14:37 schrieb Lukas Wagner:
> These patches should fix issues with certain special characters
> (e.g ü) in the notification configuration [1].
> Before, when setting a comment for an endpoint to certain values
> (e.g. 'für admins'), the resulting saved configuration would
> contain invalid UTF8 text.
>
> The reason for that was the configuration was returned from
> Rust as a proper utf8 string, however it was saved to the file
> system without specifying an encoding.
>
>
> [1] https://bugzilla.proxmox.com/show_bug.cgi?id=4937
>
applied-series, after discussing with Fabian, thanks!
We decided to make it a $force_utf8 flag instead of passing the encoding
as a string, and use the strict 'UTF-8' encoding rather than 'utf8'. See
the "UTF-8 vs. utf8 vs. UTF8" section in 'perldoc Encode' for more info.
I also moved the binmode() call to after the loop, where $fh is known to
be set.
We also found that file_get_contents() doesn't set Perl's UTF-8 flag for
strings even if the input is UTF-8, because it uses sysread(). It's fine
for the notification configs apparently, but going forward, we'll need
to be careful. One idea was an opt-in parameter for detecting UTF-8 and
setting the Perl string flag and using that for (most) cluster
filesystem files.
prev parent reply other threads:[~2023-09-11 12:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 12:37 [pve-devel] " Lukas Wagner
2023-08-30 12:37 ` [pve-devel] [PATCH pve-common 1/3] tools: allow to specify file encoding for file_set_contents Lukas Wagner
2023-08-30 12:37 ` [pve-devel] [PATCH pve-cluster 2/3] cluster fs: allow to specify file encoding for cfs_write_file Lukas Wagner
2023-08-30 12:37 ` [pve-devel] [PATCH pve-cluster 3/3] fix #4937: notify: write configuration files in utf8 encoding Lukas Wagner
2023-09-01 7:40 ` [pve-devel] [PATCH common/cluster 0/3] fix #4937: fix utf8 encoding issues while saving notification config Lukas Wagner
2023-09-11 12:50 ` Fiona Ebner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d7c21cbe-afff-22e9-7878-c427d093958b@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=l.wagner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.