From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Zipping files with local characters

Solved!
Go to solution

Hi Community,

 

I'd like to zip files with LabVIEW but the filenames in the zipfiles get messy whereever I use none english characters such as "á", "é" etc. If I zip outside of labview then the filenames are fine, so I assume its a labview thing. Can you help me out how can I zip these filenames properly? Removing / altering the filenames is not an option.

 

thanks!

 

The code I use currently:

 

 

zip.png

 

 

0 Kudos
Message 1 of 11
(4,008 Views)

You can read all about the character encoding with LabVIEW here: https://decibel.ni.com/content/docs/DOC-10153


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 11
(3,995 Views)

I have checked that document briefly before I have sent my post. I have sent the UseUnicode = True, it makes no difference. Anyways I dont think it is really applicable as applicable as the problem lies in the Add file to zipfile.vi which is password protected. The paths coming in into this VI have the filenames with the correct characters.

0 Kudos
Message 3 of 11
(3,975 Views)

Perhaps you could use a command line zip utility instead?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 11
(3,969 Views)

Yeah, thats an option.... It would be neat though to solve it within labview.

0 Kudos
Message 5 of 11
(3,966 Views)
Solution
Accepted by topic author 1984

@1984 wrote:

I have checked that document briefly before I have sent my post. I have sent the UseUnicode = True, it makes no difference. Anyways I dont think it is really applicable as applicable as the problem lies in the Add file to zipfile.vi which is password protected. The paths coming in into this VI have the filenames with the correct characters.


There is no easy way to solve this. The zlib library and in fact really accompagning miniZIP library that was used for the ZIP implementation in LabVIEW does not do anything about character encoding. ZIP files traditionally use whatever DOS codepage the system used back then. The DOS codepage is however not the same as the ANSI codepage that normal Windows GUI applications are using. So any special character in LabVIEW is passed to the ZIP function and there interpreted as a different character.

 

The most simple solution would be to convert the filenames to the OEM codepage before passing them to the ZIP function and converting back from OEM to ANSI when receiving filenames from the functions. Newer ZIP formats also support UTF8 encoding but that is not supported by the miniZIP library used for ZIP support in LabVIEW.

 

I've been battling with these issues in the OpenG ZIP Toolkit Library too and it is a very tricky and involved problem especially if you consider that it should work on more platforms than just Windows. For the moment I have decided to sidestep that problem and concentrate on getting a new release of the library out, without trying to deal to much with those character coding issues.

 

My recommendation really is to just avoid those special characters altogother for now.

 

And I'm not sure you would gain much by calling a command line utility. Unlike Windows GUI programs the command line utility works with the OEM codepage too and assumes that its parameters are in that codepage, so you would have to translate special characters anyways before building the command line string.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 11
(3,900 Views)

Great explanation. I need those spec characters, so I just decided to use fbzpack which is a 300k command line tool requires no installation and then call this tool with a system exec. Seems to work great. Not ideal as I have to have that tool, but its not too much of a hassle.

 

Kinda odd though that the ZIP VIs shipped with labview cant do this.

 

Thanks to both of you.

0 Kudos
Message 7 of 11
(3,888 Views)

Why odd? It's not a problem for English locales and that is where LabVIEW is developed in! Smiley LOL

It also makes the code base a lot more complicated. There is a reason that LabVIEW still doesn't officially support Unicode. It's a can of worms with a 7 headed Hydra waiting behind, to be slashed and conquered.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 11
(3,881 Views)

@1984 wrote:

Great explanation. I need those spec characters, so I just decided to use fbzpack which is a 300k command line tool requires no installation and then call this tool with a system exec. Seems to work great. Not ideal as I have to have that tool, but its not too much of a hassle.


I really like 7-zip.  It is a free tool (open source) and has a command line interface that is pretty simple.  I have not tried the special characters yet, so that might be something to try.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 11
(3,874 Views)

Great answer! 🙂

0 Kudos
Message 10 of 11
(3,874 Views)