Use this.getclass (). getClassLoader (). GetResource (""). GetPath () Gets the file path of the Chinese name and inserts the binary data into MySQL, but an error occurred, the print path, Find the path is garbled, it should feel like
The problem of coding, Baidu looked under, find others to provide solutions, tested, feasible.
http://blog.csdn.net/lzzyok/article/details/7886914
In use like this:
Java code
- This.getclass (). getClassLoader (). GetResource (""). GetPath ()
To get the file path, the path space inside will be replaced by "%20", at this time if you use this to obtain a path containing "%20" to new file, there will be no path found error.
Then there are the following official solutions:
Java code
- Uri uri = new Uri (Url.tostring ());
- FileInputStream FIS = new FileInputStream (Uri.getpath ())
But there is another workaround:
Java code
- Configpath = Java.net.URLDecoder.decode (Configpath,"Utf-8");
So, the problem solved ...
This.getclass (). getClassLoader (). GetResource ("") encountered a workaround with Chinese path