The encoding of files mainly occurs in the file path of the build code, and it is precisely because of the encoding inconsistency between client and server and application that we need to be aware of the default encoding of different platforms when dealing with it. Although it is a small matter to develop functions, software and architecture, it is also a headache to solve.




Windows File Server

For Windows, the default code for simplified Chinese is GBK series. The default encoding for Linux is UTF-8, which is consistent with the encoding required by the program development platform and some development languages. If the Linux server is used to publish the code, the encoding problems for file upload and download can be ignored. All you need to do is contract the encoding with the visiting client (utF-8 is generally fine for data transfer, but for file systems, you need to convert the default encoding). Today’s development of the program is in the coding of the loss, the need to convert the file name encoding into isO-8859-1 format of the file name, to avoid filename garbled or Chinese name empty.

Change the code: new String(filename.getBytes (),” ISo-8859-1 “);


Although the code I’m writing today is a long way from my previous position, I’ll start at the bottom. You know what your weaknesses are?