SoFunction
Updated on 2025-03-11

Detailed explanation of the problem of trying not to use Chinese paths in android development

During the development process, I found that some software does not support Chinese paths well. If you use the conversion Chinese path to URI, some software may not be able to recognize it, resulting in abnormal functions. There are two known applications: 1. The sharing function of Tencent Weibo; 2. Call the system camera to take photos under Coolpad D530.

If you have to use the Chinese path, you can use the following method:

String path = getCameraTempFilePath(),;

//Some system cameras do not support Chinese paths well, and there are problems after coding. Please add them manually first.

//                 Uri uri = (new File(path));

 Uri uri = ("file://"+path);

 (MediaStore.EXTRA_OUTPUT, uri);