Indirect Implementation of Chinese name storage for Android files
I used to store more than 2000 Chinese Character strokes. Each Chinese Character corresponds to a corresponding stroke. I have read a lot of questions about how to store Chinese character names on the Internet.
Later I came up with an indirect implementation of the file name in windows using URLEncoder. encode (string, "UTF-8 ");
Conversion and then find the Chinese file name in Android, for example, big .gif also put urlencoder.encode(" GIF .gif "," UTF-8 ");
Find the converted file in Android
The code for converting file names in java is as follows:
Package ttatx. rename; import java. io. file; import java. io. unsupportedEncodingException; import java.net. URLEncoder;/*** rename objects in batches * @ author tiyoto **/import java. util. secret; public class BatchRenamefile {// output log public static volatile boolean isDebug = false; public static void main (String [] args) {String desc = "file path name "; file dir = new File (desc); File [] files = dir. listFiles (); int count = 0; for (File f: fil Es) {if (f. isFile ()&&! (". Nomedia ". equals (f. getName () {String string = f. getName (); try {string = URLEncoder. encode (string, "UTF-8");} catch (UnsupportedEncodingException e) {// TODO Auto-generated catch blocke. printStackTrace ();} f. renameTo (new File (desc + "/" + string); count ++ ;}}}}