Example Code

LabVIEW Converting a String to a URL in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI exemplifies how to takes a string and encodes it to a URL stripping unusable characters and correctly formatting it.

 

Description

URL encoding requires that only alphanumerics [0-9 a-z A-Z], these special characters $-_.+!*'(), and "reserved" characters used for their normal purposes may be used uncoded within a URL.

 

Requirements
LabVIEW Base Development System.

 

Steps to Implement or Execute Code
1. Load the attached VI "Calculate Cube of a Number LV 2012 - NI Verified.vi" as a subVI.
2. Set the string that you would like to encode in the String Control
3. Select if would like to encode spaces
4. Run the VI

Note: When encoding a filename or path, set this to false (it uses %20 for spaces). When encoding arguments for a CGI POST or GI GET set it to true.

 

Additional Information or References

 Snippet 2281.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
p4keal
Member
Member
on
  • Consider build in Escape HTTP URL.vi
  • I think the characters must be convertet to HEX strings. I would add %x as format string to fis .