From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Questionable behavior of "Is name Multiplatform.vi"

Solved!
Go to solution

"Is name Multiplatform.vi" claims:

 

"This VI checks if a filename is valid on different platforms according to the following rules (Windows):

  • The following characters are invalid: \, /, :, *, ?, ", <, >, and |.
  • Filenames cannot end with a period (.)."

But in fact it also does not allow multibyte characters, which Windows has no issues with: "Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following /.../ "

 

Questions:

1. Why is it not described that only characters below 128 are allowed?

2. Why are they not allowed? They should be, at least for Windows.

 

I can create my own VI with the desired behavior, but if there is a reason for the choice, I would like an explanation and better documentation.

 

There is a comment on the diagram if a character is above 127. It mentions "big 5", so I assume that it is intended to stop e.g. some Chinese coded characters:

thols_0-1613556303868.png

 

Is it that some encodings has multibyte characters already in the 127-255 range? I guess so. Maybe I answered nr 2 myself, but for "normal" encodings, we don't need that check. Maybe there should be an option for that check, like "check for multibyte characters".

Certified LabVIEW Architect
Message 1 of 9
(1,646 Views)

When I said "But in fact it also does not allow multibyte characters", I meant "But in fact it also does not allow characters above 127".

Certified LabVIEW Architect
Message 2 of 9
(1,623 Views)

And why not add a check for reserved names in Windows:

 

"Do not use the following reserved names for the name of a file:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9."

Certified LabVIEW Architect
0 Kudos
Message 3 of 9
(1,619 Views)

I think you have the intent of the VI backwards.  AND all the platforms, not OR them.  This is supposed to tell you if your filename will work on ALL platforms, not ANY platform.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 9
(1,607 Views)

@billko wrote:

I think you have the intent of the VI backwards.  AND all the platforms, not OR them.  This is supposed to tell you if your filename will work on ALL platforms, not ANY platform.


By the name of the VI, one might think so, but there is an input "filename must be valid on all platforms (F)", so by default it should only care about the current platform. This is also in the VI description.

Certified LabVIEW Architect
0 Kudos
Message 5 of 9
(1,587 Views)

@thols wrote:

@billko wrote:

I think you have the intent of the VI backwards.  AND all the platforms, not OR them.  This is supposed to tell you if your filename will work on ALL platforms, not ANY platform.


By the name of the VI, one might think so, but there is an input "filename must be valid on all platforms (F)", so by default it should only care about the current platform. This is also in the VI description.


Wow!  I did read the help, and I did remember that input, but I didn't realize its significance.  Sorry about that.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 9
(1,571 Views)

We have a hidden gem for checking file names for multiplatform issues that allows multibyte characters:

 

[LabVIEW 20xx]\vi.lib\Utility\Multibyte\Is Name Multiplatform_Allow Multibyte.vi

 

We made it a separate VI because we didn't want to change the behavior of the non-multibyte VI given how widely it was used prior to identifying the need to support multibyte characters.

Message 7 of 9
(1,551 Views)

Thanks Darren. Good to know.

 

But I still think the documentation is incorrect since it says nothing about the fact that no character higher than 127 is allowed.

 

This filename is valid in Windows:

thols_0-1613590422381.png

It may seem silly to use such characters in a filename, but some of those characters are pretty common in some not so small languages.

 

And if an improved version will ever be added then I think the reserved Windows file names should be checked too.

Certified LabVIEW Architect
0 Kudos
Message 8 of 9
(1,523 Views)
Solution
Accepted by thols

I have filed Bug 1325918 to update the documentation for Is Name Multiplatform VI to mention the multi-byte limitation, and also give the path to the hidden gem VI for users who need that functionality.

Message 9 of 9
(1,499 Views)