Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MacOS 10.4.11 Character problem



zhangzehao wrote:

File file = new File("/Users/imageworks/Desktop/表示履歴.jpg");
String[] command = {"ditto", "-ck", "--sequesterRsrc",filename, "/ Users/imageworks/Desktop/zhangh.zip"};

As a follow-up, I modified your original code and tested it.

After determining what the Unicode codes for 表示履歴.jpg were, I then entered them into the Java source as Unicode-escaped characters. The simple exec() of 'ditto' then worked as expected: ditto created the zip archive.

To test the zipped data, I double-clicked "zhangh.zip" in the Finder. It expanded the archive and named the file "表示履歴 2.jpg". Finder did this because the original file already existed, so it renamed the output to avoid overwriting an existing file.

The tests were run on OS 10.4.9 and 10.5.2, under Java 1.5. Please try the test on your 10.4.11 Mac and post results to the list.

Note that I changed the pathnames to use the current directory (./) rather than an absolute path hard-wired into the source.

  -- GG


- - - -

import java.io.*;

public class DittoTest
{
	public static void
	main( String[] args )
	{
		try
		{
			File file = new File("./\u8868\u793a\u5c65\u6b74.jpg");

			System.out.println( "source file exists: " + file.exists() );

			String[] command = { "ditto", "-ck", "--sequesterRsrc",
					file.getAbsolutePath(), "./zhangh.zip"};

			Process child = Runtime.getRuntime().exec( command );
			int status = child.waitFor();

			System.out.println( "status: " + status );
		}
		catch ( Exception why )
		{  why.printStackTrace();  }
	}
}

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.