To maintain UTF-16 characters from a file

Hello,
I have a text-file that includes some special characters (UTF-16), I must write a java class that modifies the text, maintaining these special characters. I try with:
in = new BufferedReader(new InputStreamReader( new FileInputStream("PapersVecchio.txt"), "UTF-16"));
but the file is bigger than 135 Mb, and with this code the program return:
java.lang.OutOfMemoryError: Java heap space
What can I do?
thanks
Simone

These two file have this structure :
File1:
<key=109169>conf/ecai/Seel88</key>
     <authors>Nigel R. Seel </authors>
     <title>Modelling Iterated Strategies: A Case Study.</title>
     <journal>ECAI</journal>
     <year>1988</year>
<key=347449>conf/icsoc/GimpelLDK03</key>
     <authors>Henner Gimpel Heiko Ludwig Asit Dan B. Kearney </authors>
     <title>PANDA: Specifying Policies for Automated Negotiations of Service Contracts.</title>
     <journal>ICSOC</journal>
     <year>2003</year>
File 2:
articolo: 1
Nigel R. Seel
Modelling Iterated Strategies: A Case Study.
ECAI
1988
articolo: 2
Henner Gimpel Heiko Ludwig Asit Dan B. Kearney
PANDA: Specifying Policies for Automated Negotiations of Service Contracts.
ICSOC
2003
I need to put in relation the number "key=347449" with "articolo: 2", ok?

Similar Messages

  • Can't get UTF-8 characters from XML file displayed correctly (Cocoa Touch)

    Hi there,
    I'm trying to read an XML file with Japanese and Korean characters (encoded UTF-8) into a String like
    NSString *s = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://.../data1.xml"] encoding:NSUTF8StringEncoding error:&e];
    However, the output just gives me some wrong characters. I also tried use NSData, but the result was the same.
    The same when I parse the XML file with
    NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:URL];
    The parser function just gives back gibberish.
    When I write the data into a table cell (cell.text = ...), only the first character is displayed followed by "...".
    Where can I start looking to get this right? I'm not so experienced in Cocoa yet, so I feel that I'm missing something simple here...
    Thanks,
    Thomas

    I think so (haven't checked), but it is a really simple test xml which is not really error prone).
    But the problem is a different one, because I also just tried to read a txt file with some Japanese characters into an NSString using initWithContentsOfURL.
    When I print the string in the console, I only get messed up characters (the latin characters next to the Japanese are displayed fine).
    It is a general problem of reading out an UTF-8 file from an url.
    Spent the whole last night to google something helpful but couldn't find anything. Now I'm tired at work
    Thomas

  • Does LabView program behave differentl​y under Traditiona​l Chinese version from regular English version. The program reads in numbers and characters from input files.

    Does LabView program behave differently under Traditional Chinese version from regular English version. The program reads in numbers and characters from input files.

    Hope this helps,
    Ankita

  • Reading in a certain number of characters from a file.

    Hi guys,
    I need some pointers on how to read in a specified number of characters from a text file.For example,how would I read in the first 100 characters to an array from a text file with an unspecfied number of characters (more than 100 rather than less!).
    At present I am getting code errors being thrown due to reading in beyond the array size ie
    java.lang.ArrayIndexOutOfBoundsException: 100.

    post more code , this exception tells me nothing
    without seeing what you are actually doing.
    public String getText (String file)//textfile to be analyzed will be inputted as argument 150407 0356
       //15042007 0612 Check notes on overloaded getText method below.
           int temp;
           inputFile = file;
           int i=0;
                try
                    BufferedReader bGetFile = new BufferedReader (new FileReader(inputFile));
                    while ((temp=bGetFile.read())!=-1)
                        textFromFile[i] = (char)temp;
                        i++;
                    /*for (int j=0;j<MAX;j++)
                        System.out.print(textFromFile[j]);//25042007 0208.For Testing purposes
                    inputText=new String(textFromFile).trim();
                    bGetFile.close();
                catch (IOException e)
                    System.out.println (" ");
                    System.out.println ("Sorry.An error occurred while trying to read from the input file.Unable to proceed!");
                System.out.println ("Processing the input text file "); //25042007 2318 being used for debugging purposes.          
                return inputText;
        }If the file being read is greater than MAX characters it will throw the exception mentioned.What I would like to do is read in MAX characters and discard the rest.

  • STARTED IT, BUT STILL NEED HELP -- INPUTTTING CHARACTERS FROM LOADED FILE INTO TABLE, SELECTING STRINGS FROM TABLE AND PLACING IN NEW TABLE, SAVING NEW TABLE TO SPREADSHEET FILE

    I AM TRYING TO IMPORT CHARACTERS FROM A TAB DELIMITED FILE INTO A TABLE ON LABVIEW.  ONCE THE DATA IS IN THE TABLE I WANT TO BE ABLE TO SELECT INDIVIDUAL STRINGS FROM THE TABLE AND PLACE IT IN A NEW TABLE.  WHEN I CLICK ON A STRING I WOULD LIKE THE SELECTED STRING TO SHOW IN A TEXT BOX LABELED 'SELECTED STEP'  AFTER ALL THE SELECTED STRINGS IS IN THE TABLE I WOULD LIKE TO SAVE THE NEW TABLE AS ANOTHER SPREADSHEET -- TAB DELIMITED -- FILE, MAKING IT ACCESSIBLE TO OPEN.  HERE IS WHAT I HAVE SO FAR.  I CAN INPUT DATA INTO THE TABLE, BUT I CAN ONLY TRANSFER ONE STRING INTO THE TABLE I WOULD LIKE TO BE TO INPUT MULTIPLE STRINGS.    ALSO WHENEVER I TRY SAVING THE FILE, IT ALWAYS SAVES A UNKNOWN FILE, HOW CAN I GET IT TO SAVE AS A SPREADSHEET FILE.  THANKING ALL OF YOU IN ADVANCE FOR YOUR HELP!!!!!!
    Attachments:
    Selector.zip ‏30 KB

    Pondered,
       The question you are asking is the same one that you asked in: http://forums.ni.com/ni/board/message?board.id=170&message.id=132508#M132508, to which I supplied a revised version of the original vi you used (which was modified from the original one I supplied to an earlier thread). A couple of questions: 1) What does my latest not do that is in your question, 2) Why are you starting yet another thread about the same problem?  We are here trying to help, it makes it a lot easier if you keep the same problem in the same thread, it reduces duplication of effort from those that might not have been following the previous thread(s).  Those of us that don't have our "names in blue" are just doing this "for fun" (the blue names are NI employees, who may still be doing it "for fun"), and it makes it more fun if it doesn't seem (correctly or not) that our attempts are ignored.  If an answer doesn't help, or seems incomplete, post a little more detail to the same thread so that the original respondent, or someone new, can provide more information, or understand your problem better.
    P.M.
    Message Edited by LV_Pro on 07-20-2005 01:20 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Read last characters from a file

    Hey All:
    i'm a novice when it comes to powershell- but this is what i'm trying to do.
    I have the following command-
    gwmi-classwin32_computersystem|selectName|out-filec:\computername.txt
    I want to then read the last three characters of the computername from the file. If there is a 'cleaner' approach
    please enlighten me.
    Thanks for all the help
    -Matlock

    Hi,
    Here's a method you can use:
    $name = (Get-WmiObject Win32_ComputerSystem).Name
    $shortName = $name.SubString($name.Length - 3)
    $shortName
    EDIT: Show on the draw, see Tommy's response above.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • Reading Japanese Characters from Properties File

    I am running on Windows 2000 (English). Can any one suggest on how to read Japanese Characters from a ".properties" file.
    TIA

    look at ResourceBundle and unicode encoding,
    Jim

  • Unable to pick unicode characters from input file using "outside in"

    Hi,
    I am using your product "Outside in" to read unicode text from input
    source file. For reading text I am using TReadFirst and TReadNext even
    though "It is not picking unicode characters from input source file
    and also it is giving zunk character to the buffer". How can I
    retrieve unicode character from input source using "outside in"
    product. Your help makes me learn more stuff.
    Regards,
    Naresh.D

    I am trying to use CAReadFirst and CAReadNext to read unicode characters. Even it is not picking, I think is there any flags we need to set. can any one help to this.

  • Importing special characters from text file

    My project requires me to import a text file into a dynamic
    text field by using the loadVariables() function. My problem is
    that the text file contains a ampersign "&" . It seems that the
    ampersign stops the rest of the text from being imported into my
    flash movie. Is there a special character or escape character that
    I can use to allow me to import the ampersign?
    I've tried using the &amp; and setting my dynamic text
    field to HTML. No luck. Oh.. I'm using flash MX :(
    Any ideas?

    Hey I've run into this problem and found the solution lies
    with JavaScript which can read the text just fine and then parse it
    back to Flash as escape characters:
    //JavaScript code:
    var origText = 'blah blah & then i did this & then
    blah blah";
    var newText = String(escape(origText).replace(new
    RegExp('\\+', 'g'), '%2b'));
    FlashWin.sendText(newText); // << this is a reference
    to a flash window with ExternalInterface enabled
    // end
    However, I was using HttpRequest in JS to get my original
    data. So this method is dependent on something other than Flash to
    retrieve the original text (with ampersands).
    I really hope they fix this bug in the future, it can drive
    you nuts....
    -Dan

  • Remove ?xml version="1.0" encoding="UTF-8"? from xml file

    I have generated an XML file using sax paraser. In the XML file thats generated I have the version and the encoding line
    <?xml version="1.0" encoding="UTF-8"?>which is automatically generated in my XML file. Is there any way that I can avoid that from the XML file thats generated.

      try
                            FileWriter fr = new FileWriter(new File(path, fileName));
                            Document docNode = docNodeMap.get(name);
                            XMLOutputter outputter = new XMLOutputter();
                            outputter.output(docNode, fr);
                            fr.close();
                    catch (IOException e)
                            e.printStackTrace();
                    }this the code generating xml file.

  • How do I remove spaces and special characters from the file name during rendering?

    I understand that I can set LR_renamingTokensOn to true, but I would like to replace all spaces in the file name with an underscore and remove characters not in the range A-Z and 0-9. What's the easiest way to achieve this?

    local photo = catalog:getTargetPhoto()
    local sesn = LrExportSession {
        photosToExport = { photo },
        exportSettings = {
            -- ... (determine from export preset) - whatev you want, just be sure you set export directory: LR_export_destinationPathPrefix
            LR_tokens = "{{custom_token}}",
            LR_tokenCustomString = LrPathUtils.removeExtension( photo:getFormattedMetadata( 'fileName' ) ):gsub( "[ %c]", "" ) -- remove spaces and control characters
    sesn:doExportOnNewTask()

  • How to get UTF-8 Characters from HTML to Java?

    Hi everyone, I'm trying to set up an application that will allow display and entry of international data from HTML forms via servlets. The problem is that I can't get the data back into a java string to apply to the DBMS.
    I have tried using UTF-8 and specific character sets such as ISO-8859-5 (Russian). I have specified these character sets/encodings as follows:
    HTML: meta content-type header charset=xxx and <form accept-charset=xxx
    Servlet Response: setLocale(appropriate locale) and setContentType("text/html; charset=xxx") prior to calling response.getWriter()
    Servlet Request: setCharacterEncoding("xxx") (e.g. servlet 2.3)
    When I use request.getParameter(xxx) I get normal characters (a, b, c) and nothing for international characters or sometimes question marks.
    I have also tried various combinations of:
    new String(request.getParameter("xxx").getBytes("xxx"),"xxx")
    Could someone please point me in the right direction?
    TIA

    Thanks for all of your suggestions. It still refuses to work.
    I entered the following: ���^�E on the HTML form using the Chinese(PRC)keyboard on my Win2K box.
    I checked and verified the correct encoding in the servlet request (GB2312 for chinese characters)
    request.getParameter(xxx) yields ???
    new String(request.getParameter(xxx).getBytes("GB2312")) yields three boxes (values 20309, 27946 and 23380)
    new String(request.getParameter(xxx).getBytes("GB2312"), "UTF-8") yields nothing
    Any ideas?

  • How to reve Extra special characters from source file

    Hi all
           I am doing an file to idoc scenario in which i am using SEEBURGER BIC adapter for converting flat file to xml.My input file contain HEADER ,ITEMHEAD AND FOOTER.When i am processing an error is coming extra charcterYP persent before header.While in input file its not visible,it might be some special controll character
    my file is with utf-16 format( little endian) encoding.
    Plz share if u have any idea about the sudden occurence of special character and how to overcome it.
    Regards
    Saurabh Sharma

    sorry, i meant the code for removing the special character.
    Just a quick clarification about what i read in your previous post: that you are using a SEEBURGER adapter and in this adapter there is a module deployed called BIC which does the file to xml conversion.
    So the plan is to insert the custom adapter which will remove the extra space before the BIC adapter in Seeburger adapter right. my only assumption here is that we can add this custom adapter before bic module in Seeburger adapter module tab.
    Basically i dont no whether you have the option of adding a new adapter module in SEEBURGER ADPTER BIC MAPPING DESIGNER just like there is one in File adapter.
    Please confirm

  • Reading in/writing out escape characters from/to file

    I am trying to read in a large file which has many escape/special charaters (e.g. /, double quote (" ") etc.). I need to read them as they are and then write them out in a separate file as they were in the original file (e.g. if there was a double quote in the original file, I would have to keep the double quote in the output file)
    Now my question is: how can we tell the BufferedReader and FileWriter not to treat those characters to be escape characters?
    Thanks

    Now my question is: how can we tell the
    BufferedReader and FileWriter not to treat those
    characters to be escape characters?AFAIK, you don't need to do anything special. BR and FW already do that the right way.
    Did you try the standard approach?

  • Problem displaying characters from pdf file in Preview.app

    Hi,
    I hope someone can help with this problem.
    I have some issues with the display of pdf files on OSX. The problems are with ligatures like 'fl' which Preview.app displays incorrectly as 'oeu'. There are other symbols which Preview also displays incorrectly.
    This problem is not affected by cleaning the font cache and as far as I can tell all the fonts are present and correct. I am guessing the problem has something to do with Preview finding a different version of the Times or TimesRoman font than Adobe Reader uses, and so it gets the wrong symbol, but I'm not sure.
    How can I ensure that Preview uses the same fonts as Adobe Reader? and how can I get Preview to render my pdf's correctly?
    Here is a sample of the problem with Preview.app (4.1):
    !http://farm4.static.flickr.com/3456/33599073294296beb1a8m.jpg!
    and with Adobe Reader (9.0.0)- correctly rendered:
    !http://farm4.static.flickr.com/3448/335990717548aa12e576m.jpg!

    My computer automatically open PDF inside the Safari
    window, but I wish it would go back to opening it
    externally via Adobe. (maybe we should trade
    computers:-)
    Anyway, we have the same question.
    How do we control whether PDF launches internal to
    Safari, or external in Adobe?
    This is what I would like to as well. I often have a lot of pdf files I need to open and then save to my hard drive. When I click on a pdf file on a website Safari opens it and then I need to right click in the document to open it with Adobe. How can I get it to open in Adobe the first time without having to right click after it opens in Safari?
    Thanks!

Maybe you are looking for

  • Applications there but not there

    Small problem. Just bought a new iMac. Copied my iTunes library in totality from my work MacBook Pro onto the new machine. Plugged my iPhone in to sync. Everything works fine - it asked me to authorise new computer with my iTunes store account. Then

  • Having trouble installing Photoshop on Mac OSX 10.7.4

    Hello Im having trouble installing Photoshop CS6 and Illustator CS6. I am geting the following errow while trying to install in Creative Cloud Download Manager: Exit Code: 34 -------------------------------------- Summary ----------------------------

  • Can´t install cd recorder in linux... help please, newbie

    hi, is there any problem with via chipsets and cd recorders in linux??   I´ve been trying to install a linux distro in my pc ( see end of post for specs), but i haven´t succeded in installing my cd recorder. I´ve tryed RedHat 8.0 and Mandrake 9.0. In

  • External RAID-1 storage providers?

    I'm looking for suggestions and providers of RAID-1 (mirroring) storage solutions. I work in-house for a corporate video company and we think that an external RAID-1 storage would be best. I'm also very open to hear what other people think would work

  • How do i unlock numbers files

    All files in Numbers (Apples Excel) are locked. I think it's because of 10.7. Help