Convert UTF8 to 8-bit intellegently

I need to convert a UTF8 file into 8-bit.
Of coarse, there is no way to do this perfectly, but it would be nice if there was a function that would make an intellegent substitution for characters that aren't in ASCII. For instance, the curly double quotes character would become a normal double quotes.
I tried using String.getBytes("ISO-8859-1"), but it just subsitutes a question mark for all characters that aren't in ASCII.
Anyone know of a function that can do this?

just wrote Very long winded method for most of the common utf-8
//list of unexcepted frequent chars: �����������������������������������������������������������
StrAllData = StrAllData.replaceAll("�", "\"");
          StrAllData = StrAllData.replaceAll("�", "\"");
          StrAllData = StrAllData.replaceAll("�", "\'");
          StrAllData = StrAllData.replaceAll("�", "\'");      
          StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "A");
          StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "A");
          StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");
          StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");
          StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "I");
          StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "I");
          StrAllData = StrAllData.replaceAll("�", "N");                StrAllData = StrAllData.replaceAll("�", "O");
          StrAllData = StrAllData.replaceAll("�", "O");                StrAllData = StrAllData.replaceAll("�", "O");
          StrAllData = StrAllData.replaceAll("�", "A");                StrAllData = StrAllData.replaceAll("�", "E");      
          StrAllData = StrAllData.replaceAll("�", "E");                StrAllData = StrAllData.replaceAll("�", "E");      
          StrAllData = StrAllData.replaceAll("�", "E");               StrAllData = StrAllData.replaceAll("�", "I");      
          StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "B");      
          StrAllData = StrAllData.replaceAll("�", "I");                StrAllData = StrAllData.replaceAll("�", "N");      
          StrAllData = StrAllData.replaceAll("�", "a");                StrAllData = StrAllData.replaceAll("�", "O");      
          StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "a");
          StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "a");
     StrAllData = StrAllData.replaceAll("�", "a");               StrAllData = StrAllData.replaceAll("�", "c");               
     StrAllData = StrAllData.replaceAll("�", "e"); StrAllData = StrAllData.replaceAll("�", "e");
     StrAllData = StrAllData.replaceAll("�", "e");               StrAllData = StrAllData.replaceAll("�", "e");
          StrAllData = StrAllData.replaceAll("�", "e");               StrAllData = StrAllData.replaceAll("�", "i");
          StrAllData = StrAllData.replaceAll("�", "i");               StrAllData = StrAllData.replaceAll("�", "i");
          StrAllData = StrAllData.replaceAll("�", "i");               StrAllData = StrAllData.replaceAll("�", "n");               
          StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "o");
          StrAllData = StrAllData.replaceAll("�", "u");               StrAllData = StrAllData.replaceAll("�", "e");
          StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
          StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
          StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "u");
          StrAllData = StrAllData.replaceAll("�", "y");               StrAllData = StrAllData.replaceAll("�", "Z");               
          StrAllData = StrAllData.replaceAll("�", "o");               StrAllData = StrAllData.replaceAll("�", "y");
          StrAllData = StrAllData.replaceAll("�", "z");               StrAllData = StrAllData.replaceAll("�", "e");
          StrAllData = StrAllData.replaceAll("�", "S");               StrAllData = StrAllData.replaceAll("�", "o");
          StrAllData = StrAllData.replaceAll("�", "s");               StrAllData = StrAllData.replaceAll("�", "Y");

Similar Messages

  • I want to convert pictures to 1 bit image

    dir sir;
    i want to make a programe by it i want to upload image real image and then it converted it for 1 bit image ;
    can i use java to do that?
    and if soo what method and package and function helps me to do that .
    if you can provide me with simple code i will be thankfull.
    beast regards.

    Hi,
    if you have vision, you could use the functin IMAQ Image to Array to have a 2D array of the pixel values.
    You can then compare pixel by pixel; if your images come from a camera, I would recommend to set a treshold of acceptance.
    This is a time consuming solution anyway.
    Alternative methods:
    1) Make a subtraction of the two images, the resulting image will be the difference of them
    2 ) Use IMAQ LogDiff function (operators palette)
    3) Calculate the histogram of both image and compare the histogram reports
    Good luck,
    Alberto

  • Converting BACK to 64 bit in CS5

    I know I went to a folder whose name I cannot remember in finder and selected "get info" and then somehow converted to 32 bit but now I wish to convert back to 64 bit,
    Can anyone help me with this?

    OK I just found the right info box. I unchecked open in 32 bit. Thank you both very much.

  • Batch utility to convert 24 to 16 bit

    any recommend a batch utility to convert 24 to 16 bit for a sound library? thx Alan

    Thanks Rohan & Rockbottom.
    Library conversion was smooth. Logic performed(seemingly)flawlessly.Samples sound great.Used #3 dither. I converted the Giovani Edition by Bela D. Most of what i do is fine to my ears at 16 bit & my rig never ever even flinches. Many of the new great sound librarys out there are 24 bit & now i can choose which bit world to be in depending on the project.
    Rohan, i poked around your site.Really great music.But it was late that night & i was kind of chilling & was digging the "Peter Pan" cue & then the Coo Coo clock scareded me out of my seat.
    Cheers,
    Alan

  • Convert UTF8 to WE8ISO8859P1 or WE8ISO8859P15

    Hi!
    If got the following situation:
    I've got a database with the character set WE8ISO8859P1.
    I've got a second database with UTF8.
    I think all databases are 10.2.xx
    There is a pl/sql interface on the WE8ISO8859P1 Database which reads data from the UTF8 database via database link.
    But after inserting UTF8-data into the WE8ISO8859P1 database, the are not converted correctly automaticaly.
    How can i convert UTF8-data within my WE8ISO8859P1 database to WE8ISO8859P1-data?
    Is there a standard function within the WE8ISO8859P1 database?
    e.g. Select standard_convert_func(my_col, 'UTF8', 'WE8ISO8859P1') from myTable@db_link
    Or is the better way to convert this utf8-data to WE8ISO8859P1 within the UTF-8 database?
    insert into my_interface_tabele(my_col) select standard_convert_func(my_col, 'UTF8', 'WE8ISO8859P1') from my_utf8_base_tabel;
    Thank you for your help!
    Best regards,
    Thomas

    Hi!
    Within my ISO-DB i receive the following results in SQL*Plus:
    SQL> select convert(DN_DIENSTTITEL, 'WE8ISO8859P1', 'UTF8')
    2 from dn_stammtest@lsal_n_pep_test_link;
    CONVERT(DN_DIENSTTITEL,'WE8ISO8859P1','UTF8')
    A K B A R I A N `ag6 ¿ N a t a l
    SQL> ed
    Datei afiedt.buf wurde geschrieben
    1 select dump(DN_DIENSTTITEL)
    2* from dn_stammtest@lsal_n_pep_test_link
    SQL> r
    1 select dump(DN_DIENSTTITEL)
    2* from dn_stammtest@lsal_n_pep_test_link
    DUMP(DN_DIENSTTITEL)
    Typ=1 Len=40: 0,65,0,75,0,66,0,65,0,82,0,73,0,65,0,78,0,32,1,96,1,97,1,103,4,54,32,172,0,32,0,78,0,9
    I will contact the DB-Admin to do this select within the UTF8 DB.
    Best regards.
    Thomas

  • How to convert color image(24 bit) YUV 4:2:2 to gray scale 8 bit image

    I am using sony DFW-X700 color camera for one of vision applications.Does NI Compact Vision System(CVS) support YUV 4:2:2 format(8 bit each).I want to do gray scale processing, so i need to convert the YUV color into gray scale (8-bit) in the software(like Labview). Please suggest us how to do this conversion for better gray scale image clarity from color.

    In YUV color space, Y represents the gray scale; in RGB color space, R=G=B represents gray scale. You can simply set R=G=B=Y, to convert YUV to RGB. If the original color depth is 24 bit, then the result is 24 bit too.
    You can create gray scale color table like this:
    array size = 256;
    [0] = 0x000000;
    [1] = 0x010101;
    [2] = 0x020202;
    [255] = 0xFFFFFF;
    To convert 24 bit gray scale to 8 bit, check every pixel in 24 bit image to find the array index according to the color table, and replace the pixel with array index.
    George Zou
    http://gtoolbox.yeah.net
    George Zou
    http://webspace.webring.com/people/og/gtoolbox

  • Field dominance? converting progressive to 10 bit uncomp for beta output

    Hi,
    I shot my film on an HVX 200 720p60 format. So the field dominance of my timeline is set to none.
    I am now trying to convert this footage to 4:3 SD letterboxed by putting the QT file of the completed film into a timeline with settings 720x486, 10 bit uncompressed, 29.97. I'm looking to output the film to a beta sp master and I don't know what field dominance to set it to.
    Thanks

    Do you have a capture card? Not to be snide or anything, just asking. Because the cards have, in their interfaces (AJA control Panel for example) options for full screen and letterbox.
    Shane

  • Converting UTF8 to US7ASCII

    Hello,
    We have a database which is 9i and has a NLS_CHARACTERSET set to US7ASCII.
    We created a new database (version 10g 10.2.0.2.0) on a new server which has a NLS_CHARACTERSET set to UTF 8. When we exported the database from the 9i database to 10g database, obviously because of the NLS_CHARACTERSET there was an issue of data corruption (Columns width increasing by 3 times, understandable). Is there a way to convert the UTF8 character set on the 10g database to US7ASCII character set, and then re-importing and exporting the 9i database to 10g database. I know we can convert a subset to superset. I want to find out if there is a way to convert a superset to a subset.
    Or do I have to re-create the whole database again.
    Thanks,
    Kalyan

    You shouldn't have problem migrate a US7ASCII to UTF8. UTF8 is superset of US7ASCII.
    The problem you are facing is when your schema has column defined as CHAR(20) for example, a single byte character becomes a two-byte character in UTF8, you now have Data Truncation issue. Same problem can also happens in varchar type.
    You can't change from superset to subset for obvious reason but you can convert your 9i from US7ASCII to UTF8 if you like.
    Also run this character set scanner before you make conversion.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96529/ch11.htm#1005049

  • SUN Solaris Converting JVM to 64-Bit

    Is anyone familiar with the stpes needed to convert a J2EE instance using 32-bit Java to 64-bit on Sun Solaris? 
    The directory structure on Sun is a bit stange with "sparcv9" directories below /usr/java/bin and usr/java/jre/bin and /usr/java/jre/lib.  The "sparcv9" directories contain the 64-bit java code.
    Thanks,
    Dan

    Hello Dan,
    Unfortunately it is not easy to switch from 32bit to 64bit. The procedure that you need to use is called heterogeneous system copy. Please refer to the following documentation:
    http://help.sap.com/saphelp_nw70/helpdata/en/a2/2f0c173a5e43d19585724239ff4de7/frameset.htm
    System Copy and Migration [original link is broken]
    Regards, Ventsi

  • How to convert an array of bits into an array of bytes?

    If I have an array of 1s and 0s, how can I pack them
    into an array of bytes (8 bits)?
    Thanks.

    NI recommends to get rid of 4.x mode (Quote from the help file: "National Instruments recommends reworking any application that uses the Convert 4.x Data mode as a long term solution."). For this reason, I have attached an alternative example to give you some ideas.
    (The previous example (using 4.x type cast) is actually slightly flawed, because for some reason it only produces even sized output arrays (why???) so you would need to trim the resulting array as a function of the input array size.)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    OnesAndZeroesU8v2.vi ‏43 KB

  • Converting digital waveform into bit sequence

    Dear friends,
    I am stuck with the task of converting a digital waveform (16 bit values) into
    the following waveform:
    each sample of the original waveform should be represented by a sequence of
    bits (or H and L analog values) in the second waveform,
    the duration of the bit sequence should be half (in general arbitrary fraction)
    of the sample clock period of the original waveform,
    the bit sequence should be padded by zeros so that the total duration of the
    bit sequence and the pad equals to the sample clock period of the first
    waveform.
    I tried to represent these two waveforms in the picture attached.
    It would be really great if someone could give me hints/suggestions to this
    problem!
    Thanks in advance!
    Attachments:
    waveforms.JPG ‏21 KB

    Hi SamboNI,
    Thanks for your reply!
    I have couple of notes:
    I tried to implement your instructions but the LabView gives error message
    (please see the screenshot attached).
    I guess there should be "Boolean to (1,0)" VI between "Number to
    Boolean Array" and "Build Array" VIs (?)
    The problem I have is a bit more complex:
    I have a digital waveform (16 bit integers). I need to transform the waveform
    in the easiest and fastest way into the following form:
    Each sample of the original waveform (16 bit integer number, i.e. 5) should be
    represented by a sequence of 0s and 1s corresponding to the bit sequence of that number (0000000000000101 for 5) padded
    by a sequence of zeros (i.e. 00000) in the final waveform. I will use the
    final waveform to drive single line of the 6534 board instead of 16 lines of
    this bopard in the case of the original waveform.
    More generally:
    I need to realize communication protocol with the AD5541
    Digital-to Analog converter from Analog Devices (
    http://www.analog.com/en/prod/0%2C2877%2CAD5541%2C00.html ) using 6534 NI
    board. Therefore I need also build SCLK and CS waveforms and synchronize
    them with the DATA waveform I was talking above. Is there a way to do this?
    By the way - do LabView have standard means to communicate
    with devices like AD5541? Does it require a special software module and/or
    hardware board?
    Thanks in advance!
    Attachments:
    NumToBoolErr.JPG ‏16 KB

  • Convert utf8 char in a NSString

    Hi to all! I recieve from my server a XML file. I use NSXMLParser to retrieve attributes and values. The problem is this: i've many utf8 encoded char in many attributes, and i recieve them in NSStrings.
    //in - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict DELEGATE
    NSString *myAttribute = [[NSString alloc] initWithString:[attributeDict valueForKey:@"attribute"]];
    The NSString at key "attribute" can contain UTF8 char as ò and similar.
    How can i decode them to obtain a NSString with ò instead of ò and so on?

    I understood that you helped me, I will need to use
    parseInt to convert the string to number...No.
    Assuming you've got the "15:00" part, say in a String called timeStr, you'd just pass that to dateFormat.parse(timeStr)
    but I
    need to know where in the String are my numbers...
    isn't it? How may I do this? Well, that depends.
    What's your logic for finding it manually? Is it the first occurrence of any numerical digit in the string? Is it at a known, fixed character index? Some other logic?

  • Convert UTF8 clob charset

    Thanks for your advice.
    Actually NLS support may not apply to my case because I need to specify different charset when I need the CLOB UTF8 data from my database. Maybe this time I need Big5, next time I need GBK. The thing is, I know there is a function to convert varchar2 from UTF8 to different charset.
    Question is: can I convert CLOB as well?
    Thanks for any advice!

    There are no SQL convert functions to handle CLOB conversion in Oracle8i . In 9i all SQL functions for VARCHAR2 will work with CLOBs too.
    Why do you need to have do the conversion explicitly, if you set your client NLS_LANG character set to ZHT16BIG5 or ZHT16GBK , they these CLOBs should be converted to the client Character set automatically.

  • Converting a Signed 16 bit colour Image to 32 bit Image without Losing the Colour

    Hi,
    I am using the IMAQColourHistogram which only accepts 32 bit image inputs. I changed the Image from 16 bit to 32 bit using 'Cast Image'. The program worked but inserting an indicator, I realised that the Cast Image actually changes the Color in the image to a black and white Image. Is there a way I can change the 16 bit to 32 bit without losing the colour. 
    Any suggestions on this would be very helpful as I am currently stuck in my project.
    Thanks.

    Hi,
    Is your 16bit image a real color image or only a grayscale image with a false color palette?
    If your image is only a grayscale image, simply use the IMAQHistogram function  (located in the Analysis palette) wich accepts 8 and 16bit images.
    Color images are 32bit because you have 3 planes of 8 bit (Red, Green, Blue)
    16bit are not usually color images, but grayscale image with extended pixel depth compared ti traditionnal 8bit images.
    Regards

  • Converting "UTF8" files to other encodings in Text Wrangler

    Hi and thanks for your help
    I have several text files I can easily use in different ways using Text Wrangler.
    I need to convert text files originally written with different enchodings and I get errors.
    I can overcome this using this script:
    tell application "TextWrangler"
       tell document 1
           set line breaks to Unix
           set encoding to "Cyrillic (Windows)"
       end tell
    end tell
    However my attempts to create a loop always return this error
    TextWrangler got an error: An unexpected error occurred while processing an Apple Event (MacOS Error code: -10000)
    What is wrong with my script?
    set inputfolder to (choose folder)
    set theFiles to list folder inputfolder without invisibles
    tell application "TextWrangler"
    repeat with x from 1 to count of theFiles
              set thefile to item x of theFiles
              set inputfile to quoted form of (POSIX path of inputfolder & thefile)
      set line breaks to Unix
           set encoding to "Cyrillic (Windows)"
       end tell
    end repeat

    If its not typo you have the end tell inside the end repeat. Should be the other way.
          set encoding to "Cyrillic (Windows)"
       end tell
    end repeat
    end
    That shouldn't even compile.

Maybe you are looking for

  • How to get stateful and stateless session bean in second jsp

    I create stateful session bean in the first jsp, then how can I get the stateful session bean in the second jsp? I find that somebody store the bean in HttpSession. If I store the stateful session bean in HttpSession, then I can get it in the second

  • IPhone 4 - Pioneer Speaker System No Longer Works After Firmware Update

    To Whom It May Concern, I recently updated the firmware on my iPhone 4 from 4.1 to 4.2.1. Unfortunately, as soon as I did that my Pioneer (XW-NAV1K-K) Speaker System no longer works with my iPhone. Are there plans on correcting this in the next firmw

  • Icloud storage purchase...

    So I got 25 gigabytes (5 free and 20 for 40$) in May and now the same amount would cost $12? ..... Does the 20 Gig for 0.99 a month actually give you 25 or just 20 Gig??   If it is 25 Gig, is there any way to get the current pricing??? 

  • How can I clean up old footage in FCPX?

    How can I clean up old footage in FCPX? I have some older 4x3 TV analog video that has some pretty noticeable noise and fuzz in the image. Anyone know how I can clean them up a bit? Thanks!

  • Job Chain in RAC Environment

    Hi, i've a job chain defined in a RAC environment. I need that all the steps of my chain are performed on the same instance. How can i do this? Now stepA run on the instance 1 and stepB run on the instance 2. Thanks.