Convert String from ASCII to ANSI

Hi,
a command line instruction via LabVIEW function "System Exec.vi" retrieves me a string in ASCII format. Is there a function to convert string from ASCII to ANSII format? I use LabVIEW 8.5 German Installation.
Kind Regards
Christian
Test Engineering
digades GmbH
www.digades.com

Hallo Christian,
AFAIK there is no such in function in LabView...
But you can:
- use "Search and replace string" to search for ASCII chars and replace them by their corresponding ANSI char, do this in a loop for all chars to be replaced (acceptable speed for small strings...)
- convert the string to an U8 array and use a lookup table to convert all bytes from ASCII to ANSI, convert back to string (may be faster for long strings...)
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome

Similar Messages

  • Two Spaces being converted to from ascii 32,32 to ascii 160,32

    Two Spaces being converted to from ascii 32,32 to ascii 160,32 when the page is
    loaded by the browser.
    This problem is exhibited when viewing an address page in personal data that contains
    two spaces in the address field. i.e.. APT102- 102 Elm St.
    We put debug traces in to display the ascii character values of the spaces before
    and after the record is brought up. This debug showed that the two spaces change
    from
    Before:      space,space or ASCII(32),ASCII(32)
    After:      ASCII(160) ASCII(32)
    This is causing the application to display a record change warning. This occurs
    on IE 5.5, 6.0, Netscape 6, but DOES NOT occur using the Opera 6 browser. For
    what it's worth, the database is Non-unicode.

    Forgot to add:
    This is WEBLOGIC SERVER 5.1 sp 9 running on Win2k

  • Convert String from UTF-8 to IsoLatin1

    Hi everyone !
    I'm trying to convert a String from utf-8 to IsoLatin1, but i got somt problems.... I'm using
    actually this code, but it won't work...
    I'm getting a utf-8 html String with some data and i will write it down in latin1 to a text file
    String newString = new String(oldString.getBytes("UTF-8"), "ISO-8859-1");If i'm now writing this newString to a TextFile it contains cryptic signs like
    & # 1 3 ; or & # 1 3 7 ; or & # 1 2 8 ;(i separated this chars)
    can anyone tell me where is my fault and how can i solve this problem ?
    Thanks a lot
    Edited by: Sephiknight on Feb 23, 2008 2:41 AM

    Yes its XML, i got a web editor where i can add input (utf-8) and i want to write it down in my class to a xml file (isoLatin1).
    My code looks likte this
         public static void setEditFragment(String content, String xPath) throws Exception {
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder  = factory.newDocumentBuilder();
             Document document = builder.parse("3001300.xml");
             XPath xpath = XPathFactory.newInstance().newXPath();
             Node node = (Node)xpath.evaluate(xPath, document, XPathConstants.NODE);
            Charset charset = Charset.forName("ISO-8859-1");
            CharsetEncoder encoder = charset.newEncoder();    
            ByteBuffer buf = encoder.encode(CharBuffer.wrap(content));
            node.setTextContent(buf.toString()); 
               // Use a XSLT transformer for writing the new XML file
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
             DOMSource        source = new DOMSource( document );
             FileOutputStream os     = new FileOutputStream("tmp.xml");
             StreamResult     result = new StreamResult( os );
             transformer.transform( source, result ); 
         }The example from http://www.exampledepot.com/egs/java.nio.charset/ConvertChar.html looks great, but if I add my own input string i get a exception that looks like this
    java.nio.charset.UnmappableCharacterException: Input length = 1
         at java.nio.charset.CoderResult.throwException(Unknown Source)
         at java.nio.charset.CharsetEncoder.encode(Unknown Source)
         at HagerAbs.setEditFragment(HagerAbs.java:91)
         at HagerAbs.main(HagerAbs.java:108)When i write my input to the xml file it doesnt look like xml at all, it looks more like
    <synthese>& # 13;
    & # 13;
    & lt;br/& gt;& # 13;
    & lt;img class="thumb" src="http: ......{code}
    (i seperated the char so you can see)
    and this is not what i expected... how can i write it down correctly ?
    Edited by: Sephiknight on Feb 23, 2008 3:26 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • I need a java function that convert string to ASCII,

    I have a string like "test123"
    I want to convert this string to ascii code?how could I do this

    It is not compeltely clear, what you need, but String has this method:
    public byte[] getBytes(String charsetName)  throws UnsupportedEncodingException

  • Convert string to ascii

    does anybody know how to convert a string to it's ascii code?

    does anybody know how to convert a string to it's
    ascii code?In Java characters are represented with Unicode,
    http://unicode.org
    Fortunately the commonly used Basic Latin Unicode character set corresponds to the ASCII character set. So to get the ASCII representation of a char you just interpret the char as a number.
    char ch = 'A';
    int i = ch;
    System.out.println("Both Unicode Basic Latin and ASCII use " + i + " to represent an " + ch);

  • Convert file from UNICODE to ANSI

    Hi,
    After i read-in a file using FileInputStream,
    1. I need to detect if its in UNICODE format. How to do that?
    2. If it is, i need to convert it into ANSI (so that i can parse it later on) How?
    Any hints/solutions?
    Thanks,
    -V

    Hi,
    After i read-in a file using FileInputStream,
    1. I need to detect if its in UNICODE format. How to
    do that?It's very difficult to determine the encoding of an arbitrary chink of text. If you have a specific set of possibilities, then it gets easier. What are the possible encodings that file could be?
    2. If it is, i need to convert it into ANSI (so that
    i can parse it later on) How?
    Any hints/solutions?What do you mean by ANSI encoding? There's no such thing as "ANSI encoding", but that usually referes to Windows-1252. (http://www.cs.tut.fi/~jkorpela/chars.html#win) If that's what you're also referring to, then there's not really any way to convert Unicode to 1252. Unicode is a superset of 1252. If the file has any characters outside of the range defined by 1252, then there's no conversion to be done, that character simply doesn't exist in 1252.
    I recommend you read this:
    The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
    http://www.joelonsoftware.com/articles/Unicode.html
    Thanks,
    -V

  • Convert string to ASCII entities

    Does anyone know if Java has a method to change 'a' into '&#97;', 'b' into '&#98;' and so on? Or at least change 'a' into the ASCII value '97'?
    thanks.
    ben

    char c = ...; // get your char
    int ascii;
    if (c < 128) {
      ascii = c;
    else {
      throw new OutOfMemoryError("not ascii!");
    }

  • Converting string from file to array

    I'm new to LabVIEW and have been thrown into the middle of a project, so I need to get some code working fast! Can someone help me understand why the VI I've attached isn't working? I want to have a text file that contains a list of integers that will be used to reference particular elements in arrays within my program. I tried to follow an example I found, but the output that should be an array is coming out as a scaler. Any help would be super appreciated! Thanks!
    Solved!
    Go to Solution.
    Attachments:
    string_to_array.vi ‏9 KB
    exp.txt ‏1 KB

    First, let's explain the reason for your error: The reason why it's happening is that you're trying to do two different things at the same time. You're auto-indexing the array and you're trying to index the array inside the loop. When you wire an array to a for loop it auto-indexes the loop. Meaning LabVIEW knows how many times to run the loop - there is no need to wire to the N terminal. Also, the wire inside the loop will be an instance of the element of the array, not the array. So, the wire inside the loop is a scalar. Thus, the reason for the broken wire - you can't index a scalar.
    Also, I'm not sure what you're trying to do with the indexing of the one element of the cluster. The cluster is empty, so there's nothing to index. Presumably the file is there to tell you which elements to pull out from the "Amp2" array from the cluster. If so, remember that auto-indexing works both ways. If you connect an "outbound" wire to the edge of a loop it auto-indexed there as well, meaning the output will be an array.
    Please read the LabVIEW Help on auto-indexing.
    Now, given all of that, here is what your code should look like:
    Note the use of the Read From Spreadsheet File VI. It makes your life easier.
    Attachments:
    fixed code.png ‏22 KB

  • How can i convert values in my string to ascii characters

    Hi guy.
    I am wrinting a code but i m stuck, I have a string with (Battle of Midway) in it, Now i want to convert each character in this string with the asci character,,,
    String temp = {"Battle of Midway"};
    so the ascii will be:
    B=66 a=97 t=116 l=108 e=101 o=111 f=102 M=77 i=105 d=100 w=119 y=121
    i found all these number for all the charachers, but i donno how to covert this string into ascii characerts... ofcurse i can do it one by one...but is there any class or method i can use for this,,,,, Once i convert all the character (from string) to ascii character THEN i have to convert it back from ascii to character,,
    Is anybody has any idea
    Thanks alot in Advance

    You get get the ascii code for those characters by doing something like:
    int ascii = str.charAt(0); //Get ascii value for the first character.
    Kaj

  • Convertion from ASCII to UTF8 on Oracle 8.1.7 via PLSQL

    I need to extract a string from a ascii db, put it into a variabile in a plsql procedure, then with a 'magic box' convert it into utf8 and put it into a new utf8 database.
    I need the magic box, does exist a tool, or package or procedure or..... that works like that?
    Thanks in advance!

    I suggest to post this message on the genaral RDBMS or PL/SQL forums
    Kuassi

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Converting string(which is an xml from the java side) to xml in flex

    Hi,
       I have an xml from the java side which i send as string over amf. I need to convert this to xmllist or xml and bind it to a tree. Could some one help me in doing this. My label field needs to be displayName
    this is my xml that comes as string to the flex side
    <Menu>
      <MenuItem>
        <id>1</id>
        <displayName>Add</displayName>
        <menuList>
          <MenuItem>
            <id>3</id>
            <displayName>Form1</displayName>
            <menuList/>
          </MenuItem>
          <MenuItem>
            <id>4</id>
            <displayName>Form2</displayName>
            <menuList/>
          </MenuItem>
        </menuList>
      </MenuItem>
      <MenuItem>
        <id>2</id>
        <displayName>Delete</displayName>
        <menuList>
          <MenuItem>
            <id>5</id>
            <displayName>Form1</displayName>
            <menuList/>
          </MenuItem>
          <MenuItem>
            <id>6</id>
            <displayName>Form2</displayName>
            <menuList/>
          </MenuItem>
        </menuList>
      </MenuItem>
    </Menu>

    Well, for Binding you will probably need to further convert to XMLListCollection or ArrayCollection.
    Not sure.
    However, that is the way to convert String to XML.

  • How to convert a string from upper case to lower case in FOX formula

    Hi Experts,
    How to convert a string from upper case to lower case in FOX formula?
    Thanks,
    Cheers!!!
    PANKAJ

    The last result.append( c ) should be:
    result.append( Character.toLowerCase(c) );

  • How to convert a string from lower case to upper case withour using transla

    Hi all,
    how to convert a string from lower case to upper case withour using translate,
    Thanks in Advance,
    Reddy

    Refer to this related thread
    Re: hi guys this very urgent please help

  • Convertion from ASCII to UTF8

    How do we convert the Extended ASCII character to UTF8 without using the ALTER DATABASE CHARACTER SET command

    Is [url http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/functions027.htm#i77037]convert function ?
    SQL> select convert('a','utf8','us7ascii') from dual;
    C
    a

Maybe you are looking for

  • Dreamweaver CC Mac OSX 10.9 Crashes when adding new site

    I just recently updated my OSX to 10.9 (Maverick) on my MacBook Pro (2012) and now I cannot add new sites using Site Manager. I tried doing this with both New Sites... and Manage Sites...  menu commands. When I select the root folder for the site in

  • Surface 1 Pro on 8.1 with Miracast doesn't work on Domain

    I've seen other threads about this but no clear solution.    I have a bunch of Surface Pro's running 8.1. Miracast did work before joining them to the domain.  However, there is no option to add a wireless display now that they're on the domain.   I'

  • Enhancements in Outbound IDoc Processing

    Hi, How do I find the function module where the Outbound IDoc structures are filled. Basic type: SHP_OBDLV_SAVE_REPLICA02 Message type: SHP_OBDLV_SAVE_REPLICA Thanks, Regards, Morten

  • Has anyone successfully installed RPM on Arch?

    I've read the numerous threads describing how to convert .rpm packages into pkgbuilds. But I'm trying to install Intel's VTune, which apart from being distributed in closed-source rpm packages, is also installed via a series of complicated shell scri

  • Display event for a TitleWindow?

    Hi, I have a TitleWindow attached to a button; the button is pressed and the window displays. The window is a "singleton" in the sense that it's created once and the same instance is used on each button press. I'd like to listen for an event on the T