pritesh_ugrankar has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am getting this really weird output while printing out from "uemcli". The uemcli is EMC's command line tool to manage some of their storage arrays. Now they have mentioned in the documentation that the latest version of the uemcli does have issues with Perl only on Windows and might show strange characters. I checked on the EMC forum and found a thread where someone has given a way to overcome this, but it does not work for me. This is how the output appears on the command line. Note the "yth" output appears all by itself.

C:\>perl vnxe_1.pl ythS t o r a g e s y s t e m a d d r e s s : 1 9 2 . 1 6 8 . 1 +. 1 2 3 S t o r a g e s y s t e m p o r t : 4 4 3 H T T P S c o n n e c t i o n 1 : S y s t e m n a m e = C D R - +V N X e 1 M o d e l = V N X e +3 3 0 0 P l a t f o r m t y p e = E M C +S t o r a g e S y s t e m P r o d u c t s e r i a l n u m b e r = X Y Z 0 + 1 3 4 1 2 3 4 5 6 7 A u t o f a i l b a c k = o n H e a l t h s t a t e = O K ( +5 ) H e a l t h d e t a i l s = " T h e + s y s t e m i s o p e r a t i n g n o r m a l l y . "

If the output is captured in a file, a lot of japanese characters show up. If I use utf-8, it still prints to file like how it's shown above. I know this is not a Perl problem, and I have tried utf-8 and utf-16 encoding/decoding and tried using Text::Unidecode, but either I am not using it right, or it is having no effect on the issue. Any help would be greatly appreciated.

Here's a snippet of the code I am trying. The username and password is being read from a separate file. I've removed a lot of code and only kept the code that displays the output shown earlier.

use strict; use warnings; use Text::Unidecode; my @arrayhealth = `uemcli -d $vnxe_ip -u $username -p $password /sys/g +eneral show -detail`; my ($system_name, $model, $platform_type, $product_serial_number, $aut +o_failback, $health_state, $health_details) = @arrayhealth; my @unidecode_arrayhealth = unidecode(@arrayhealth); print "@unidecode_arrayhealth\n";

Replies are listed 'Best First'.
Re: Unicode issues with emc uemcli
by haukex (Archbishop) on Sep 07, 2020 at 17:57 UTC

    As an extra debugging step, could you please show the output of the following code?

    use warnings; use strict; use Data::Dump; use IPC::Run3; run3 ['uemcli','-d',$vnxe_ip,'-u',$username,'-p',$password, '/sys/general','show','-detail'], undef, \my $out; dd $out;

      Hi Haukex,

      I get the following output. Please note. This time, I have not changed/modified the IP Address and the other information that was originally captured. I had earlier changed it in the output posted with the question for security purposes. Hope you understand. Thank you for your help and patience.

      "\xFF\xFES\0t\0o\0r\0a\0g\0e\0 \0s\0y\0s\0t\0e\0m\0 \0a\0d\0d\0r\0e\0s +\0s\0:\0 \x001\x000\0.\x001\x009\x006\0.\x001\x002\x004\0.\x006\x004\ +0\n\0S\0t\0 o\0r\0a\0g\0e\0 \0s\0y\0s\0t\0e\0m\0 \0p\0o\0r\0t\0:\0 \x004\x004\x003 +\0\n\0H\0T\0T\0P\0S\0 \0c\0o\0n\0n\0e\0c\0t\0i\0o\0n\0\n\0\n\x001\0:\ +0 \0 \0 \0 \0S\0y\0s\0t\0e\0m\0 \0n\0a\0m\0e\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0=\ +0 \0C\0D\0R\0-\0V\0N\0X\0e\x001\0\n\0 \0 \0 \0 \0 \0 \0M\0o\0d\0e\0l\ +0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0=\0 \0V\0N\0X\0e\x003\x003\x0 +00\x000\0\n\0 \0 \0 \0 \0 \0 \0P\0l\0a\0t\0f\0o\0r\0m\0 \0t\0y\0p\0e\ +0 \0 \0 \0 \0 \0 \0 \0 \0 \0=\0 \0E\0M\0C\0 \0S\0t\0o\0r\0a\0g\0e\0 \0S\0y\0s\0t\ +0e\0m\0\n\0 \0 \0 \0 \0 \0 \0P\0r\0o\0d\0u\0c\0t\0 \0s\0e\0r\0i\0a\0l +\0 \0n\0u\0 m\0b\0e\0r\0 \0=\0 \0A\0P\0M\x000\x000\x001\x001\x004\x007\x000\x000\x +008\x009\x004\0\n\0 \0 \0 \0 \0 \0 \0A\0u\0t\0o\0 \0f\0a\0i\0l\0b\0a\ +0c\0k\0 \0 \0 \0 \0 \0 \0 \0 \0 \0=\0 \0o\0n\0\n\0 \0 \0 \0 \0 \0 \0H\0e\0a\0l\0t +\0h\0 \0s\0t\0a\0t\0e\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0=\0 \0O\0K\0 \0( +\x005\0)\0\ n\0 \0 \0 \0 \0 \0 \0H\0e\0a\0l\0t\0h\0 \0d\0e\0t\0a\0i\0l\0s\0 \0 \0 +\0 \0 \0 \0 \0 \0=\0 \0\"\0T\0h\0e\0 \0s\0y\0s\0t\0e\0m\0 \0i\0s\0 \0 +o\0p\0e\0r\ 0a\0t\0i\0n\0g\0 \0n\0o\0r\0m\0a\0l\0l\0y\0.\0\"\0\n\0\n\0"

        That data is encoded with UTF-16LE. Although I'm not sure if there's a more elegant way to solve this because I'm not familiar with the "uemcli" command, by adding the following code to the example I posted above, you will get the properly decoded Perl string in $str.

        use Encode qw/decode/; my $str = decode('UTF-16', $out, Encode::FB_CROAK);
Re: Unicode issues with emc uemcli
by pritesh_ugrankar (Monk) on Sep 07, 2020 at 22:38 UTC

    Hi Haukex,

    I still do not see the upvoting radio button. I wish I could see it and give all the day's upvotes to you. I will try tomorrow. That is the least I can do for all your help. Thank you once again and you have a good day. My other gripe is I am still not able to figure out why the "\" comes before my and the code still works. It's usually my \$scalar_ref, but here it seems like \my $scalar_ref, which is baffling.

      I still do not see the upvoting radio button.

      How do I vote? in the Voting/Experience System says:

      If you don't see any vote buttons, that could be because: (a) you can't vote because your monk level doesn't grant you any votes; (b) you've used up all the votes you had; (c) you're viewing something that inherently can't be voted on; (d) you've already voted on all the votable nodes on the page.

      🦛

        Hi Hippo,

        Thank you for the update. I was able to vote about 2 to 3 days ago..but not anymore. This question I had posted here was something important related to work and Haukex and other folks who have answered truly deserve an upvote at the least from me. I'll wait for another day and see...

      \my $out declares $out (my $out) and returns a reference to it (\$out). run3 takes this to mean the output the output to be placed in $out. Without the \, you'd be passing the value of $out, which is undefined. run3 takes this to mean the child should inherit the parent's STDOUT.

      Update: Doh! I said "With the \" when I meant "Without the \". Fixed. Thenks choroba.