Results 1 to 6 of 6

Thread: Help in coding documents

  1. #1
    Join Date
    Dec 2009
    Posts
    192

    Help in coding documents

    Hello
    I'm working on different types of coding documents such as ISO-XXX, unicode. After multiple searches, I still have not found the answer. Can we automatically identify the encoding of any document when opened? Any help in this topic will interest me. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    343

    Re: Help in coding documents

    Hello,
    In absolute no, it is not possible in my opinion, but there are heuristics that can be estimated, and in general it works correctly. Ultra edit is based upon this to information for your document. But what are these heuristics and what algos, then I do not know of anything. I do not know much about this, else I would have explained you.

  3. #3
    Join Date
    Nov 2009
    Posts
    347

    Re: Help in coding documents

    Hello,
    I do not know, what exactly you want. But I have a code with me which is related to this.
    Code:
    Transformer trns = TransformerFactory.newInstance().newTransformer();
    trns.setOutputProperty(OutputKeys.INDENT, "yes");
    
    StreamResult rsl = new StreamResult(new StringWriter());
    DOMSource scr = new DOMSource(doc);
    trns.transform(scr, rsl);
    
    String xmlString = rsl.getWriter().toString();
    System.out.println(xmlString);
    Hope this will help you.

  4. #4
    Join Date
    Dec 2009
    Posts
    192

    Re: Help in coding documents

    Hello,
    Thank you for the reply. The problem is that though I put all the will of the world, I still can not return the encoding of a file that I return parameter. Have a small concrete example to achieve this result. If you have any additional information regarding this, then please do post back and help me. Thank you in advance.

  5. #5
    Join Date
    Dec 2009
    Posts
    204

    Re: Help in coding documents

    Hello,
    Even I was trying something similar to this. Here is my code.
    Code:
    Public chset findchset(File f) throws Exception{
            
            chset = c. null;
            
    
            
            System.out.System.out.println(c.);
            return ch;
        }
    I thought that finding the charset of a file is as simple as putting my file parameter DetectedCharset () but not here and I am a little palm. Should I put my file into a byte buffer? Could you complete this piece of code to find the charset of a file I have in this setting because I wade serious.

  6. #6
    Join Date
    Dec 2009
    Posts
    192

    Re: Help in coding documents

    Hey
    Here is my code, if you think that there is some problem in the coding then please guide me.
    Code:
    Public chset findchset(File f) throws Exception{
                 
            chset = c. null;
            FileInputStream flinstr = new FileInputStream(f);
            FileChannel chin = flinstr.getChannel();
            ByteBuffer buff = chin.map(FileChannel.MapMode.READ_ONLY,0, ChannelIn.size());
            
            / / TODO
    
            chin.close();
            flinstr.close();
            
            return ch;
        }

Similar Threads

  1. Replies: 1
    Last Post: 25-10-2012, 04:46 PM
  2. Replies: 8
    Last Post: 28-11-2011, 08:41 AM
  3. How to use the pop_heap() in C++ coding
    By Garrick in forum Software Development
    Replies: 4
    Last Post: 05-03-2010, 05:28 PM
  4. Convert works documents to word documents
    By Arzaan in forum Tips & Tweaks
    Replies: 3
    Last Post: 04-03-2009, 06:46 PM
  5. Replies: 2
    Last Post: 24-01-2007, 11:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,481,780.91282 seconds with 17 queries