Results 1 to 8 of 8
  1. #1
    joseluisbz is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default Create and Read Files with name including special characters (, , ,)

    Create and Read File Called .arc
    Cordial Greetings:

    How you can see the filename have a (n with tilde, u with diaresis, etc )

    I need create a file with the method.


    String defDir = "/home/cepagi/Documents/"; //for Linux case
    String defDir = "c:\\cepagi\Documents"; //for Windows case

    String MyFileName = ".arc";
    File file2 = new File(defDir+MyFileName);
    o
    FileOutputStream MyFileOutputStream = new FileOutputStream(defDir+MyFileName);

    Later of created make a reference to he..

    out.println("<a href=\""+defDir+MyFileName+"\">"+defDir+MyFileName +"</a><P>");


    The problem is that my file is called"??????.arc" and can't no to access it.
    __________________
    Jose Luis Bernal Zambrano
    Last edited by joseluisbz; 01-03-2010 at 11:51 PM.

  2. #2
    yanivby is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    This is an encoding issue. Check the encoding of the output file.
    I think your best bet is to ensure the encoding is UTF-8. But that also depends on what your requirements are on the output file encoding.
    Hope this helps :-]
    yanivby

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  6. #6
    joseluisbz is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default

    If you put link for help me...
    Maybe I can't to see it...
    "To view links or images in signatures your post count must be 10 or greater. You currently have 5 posts."

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp

    This is the link, copy-paste in your browser and see.

  8. #8
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    Hola muchacho :)

    This is not one but 10 questions :D

    Ok let's get things clear.
    First separate file creation, file-naming, file reading,
    and file content representation in some program or browser.

    We are talking about file encoding and using non ASCII chars like .


    1. Can you create in your Java code editor,
    in your file system,
    on your OS,
    simple file called .txt,
    write some text in it
    and open it later with any txt reading program?

    EDITOR:
    If you java code editor supports Unicode
    you can write char like directly
    otherwise you have to use
    16bit Unicode escape char FOR EACH char like

    min: '\u0000' = 0
    max: '\uffff' = 65,535

    Espaa is Espa\u00f1a

    Try to create this file, write, and open it:
    Java Code:
    public class SpainFileName {
    	public static void main(String[] args) {
    
    		String filePath = "C:\\temp\\.doc";
    		
    		File file = new File(filePath);
    		try {
    			file.createNewFile();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    		
    	}
    }

    2. Representation of your file name and its content in JSP and HTML links
    depends heavily on your browser settings and your JSP meta-tags

    Name of coding schema is part of meta-tag in JSP for HTML file

    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>

    Do little research on Spanish language and charset, and possibility to use
    charset=utf-8

    Check this in Mozzila Firefox
    menu View => Character Encoding => Unicode (UTF-8)
    ...or something other?


    take it easy
    don't live a vida loca :)

Similar Threads

  1. XML with special characters
    By Kaizah in forum XML
    Replies: 1
    Last Post: 11-06-2009, 02:26 PM
  2. How to index the special characters in Lucene
    By talktoudaykumar in forum Lucene
    Replies: 2
    Last Post: 04-23-2009, 07:51 AM
  3. [SOLVED] special characters (ASCII)
    By AlejandroPe in forum New To Java
    Replies: 8
    Last Post: 04-06-2009, 10:42 AM
  4. Searching for Microsoft special characters
    By Tim McDaniel in forum Eclipse
    Replies: 2
    Last Post: 02-24-2009, 03:11 PM
  5. special characters
    By ravian in forum New To Java
    Replies: 2
    Last Post: 11-16-2007, 01:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •