[pve-devel] [pve-common 1/1] setup_default_cli_env - set binmode ':encoding(locale)' for STDOUT and STDERR

Dietmar Maurer dietmar at proxmox.com
Fri Jun 29 09:46:09 CEST 2018


So that we can output wide charachters without perl warnings ...

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/RESTEnvironment.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 32ffdd1..8bf5722 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -142,6 +142,9 @@ sub init {
 sub setup_default_cli_env {
     my ($class, $username) = @_;
 
+    binmode(STDOUT, ':encoding(locale)');
+    binmode(STDERR, ':encoding(locale)');
+
     $class = ref($class) || $class;
 
     $username //= 'root at pam';
-- 
2.11.0




More information about the pve-devel mailing list