Indirect Implementation of Chinese name storage for Android files

Source: Internet
Author: User

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 ++ ;}}}}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.