public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] api: apt: Return valid utf8 on update
@ 2025-09-25 14:49 Maximiliano Sandoval
  0 siblings, 0 replies; only message in thread
From: Maximiliano Sandoval @ 2025-09-25 14:49 UTC (permalink / raw)
  To: pve-devel; +Cc: Lukas Wagner

The following call could result in a broken encoding when a package
description contains unicode characters.

    pvesh get /nodes/localhost/apt/update

One potential example of such a package was libnbd0 where the character
'—' (em dash) was rendered as 'â'.

The file at /var/lib/pve-manager/pkgupdates would also have the wrong
encoding.

This patch fixes both issues.

Reported-by: Lukas Wagner <l.wagner@proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

One unfortunate problem for reproducing this issue is that this particular
package is already on the latest version on the Proxmox VE 9.0 iso.

 PVE/API2/APT.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 0d07cf38..27842aa6 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -107,7 +107,7 @@ my $assemble_pkginfo = sub {
     if (my $desc = $info->{LongDesc}) {
         $desc =~ s/^.*\n\s?//; # remove first line
         $desc =~ s/\n / /g;
-        $data->{Description} = $desc;
+        $data->{Description} = decode('UTF-8', $desc);
     }
 
     foreach my $k (qw(Section Arch Priority)) {
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-25 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-25 14:49 [pve-devel] [PATCH manager] api: apt: Return valid utf8 on update Maximiliano Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal