In this paper, we describe the method of Base64 encoding for utf-8 of Chinese strings by JS. Share to everyone for your reference, specific as follows:
String to encode: "Select username from user"
Using Java for encoding, Java programs:
String sql = "Select User name from user";
String encodestr = new String (Base64.encode (Sql.getbytes ("UTF-8")); Coding
Coding problems in Java
First, the encoding format:
1.ASCII a total of 128 2.iso-8859-1 a total of 256, covering most of the Western European language characters 3.gb2312 contains 682 symbols, 6,763 Chinese characters
4.GBK compatible GB3212, including 21,003 Chinese characters 5.gb13030 compatible GB2312 "Chinese character coded character set for information interchange" national standard
6.utf-16 Unicode
Java coding SpecificationThe first letter of each word in the naming conventions class must be capitalized, as shown in figureUserServiceIncorrect naming methoduserService、userserviceTest caseTestEnd, suchUserServiceTestIf it starts with the abbreviation, the abbreviation should all be in uppercase, as shown in figureHTMLEditorIncorrect syntax · the class name should contain English letters or numbers, and
same problems as I do then look down, if not that may not help you in the following content.
First, check the text encoding of the current database.SHOW VARIABLES like ' character_set_% '
I am using the MySQL database, the code is as follows:
The workaround is simple to add a sentence after the database connection statement? USEUNICODE=TRUECHARACTERENCODING=GBK on the line.String url = "Jdbc:mysql://localhost:3306/db_databaseuseunicode=truecharacterencoding=gbk";String user = "root"
Java coding SummaryI. Principles of practice1. Save the page file in the same format as the statement.If you declare 2. Whether it is get, post or Javascript, the browser submits the request in the encoding format specified by the page file.3. Javascript methods such as encodeuri and encodeuricomponent use UTF-8 format to encode dataIi. HTTP and Servlet specificationsA. http protocol1. Get according to the
software system structure.The tighter the connection between the modules, the stronger the couplingThe module's independence is worse.The coupling between modules depends on the complexity of the interface between modules, the mode of invocation and the information transmitted. Coupling and cohesion are the two qualitative standards of module independence, when the software system is divided into modules, it is possible to achieve high cohesion and low coupling, improve the independence of mod
The IDE I'm using is idea, and the places where eclipse may be set up are different1. Encoding of source filesWhen writing. java files in various Ides, there is an encoding that the IDE stores files on the machine in this encoding format, such as my settings, to set the S.java file to GBK format2. At compile time, Javac will read the file in the specified encoding format and then compile it into Unicode format.For example, I joined encoding GBK this s
I. Coding and decoding involved in the Java Web
We all know that for Chinese, where I/O is involved in coding, I have already mentioned I/O operations can cause coding, and most I/O generated garbled is network I/O, since almost all applications now involve network operations, and data is transmitted over the network i
%, the former is 100 times the latter, but it does use the same number of digits in the binary. Can do better, the method is variable length coding, the guiding principle is high frequency with a shorter number of digits encoded, low frequency with a longer digit code. Huffman coding algorithm is to deal with such problems. Huffman coded Java implementation
The d
%, the former is 100 times the latter, but it does use the same number of digits in the binary. Can do better, the method is variable length coding, the guiding principle is high frequency with a shorter number of digits encoded, low frequency with a longer digit code. Huffman coding algorithm is to deal with such problems. Huffman coded Java implementation
The d
Java and JavaScript Base64 encoding
When developing Java Web applications, it is possible to use Java for BASE64 encoding on the server side, while the client can decode it with JavaScript. This requires consistency of Base64 coding mechanisms on both sides.
Using BASE64 encoding, you may encounte
encoding to store it. This will take into account the importance of storage space or the efficiency of coding (three common).
1. ASCII code
We all know that ASCII code, a total of 128, with a byte of low 7-bit, 0-31 is the control character Furu space, enter, delete 32-126 is the print characters, can be entered through the keyboard and can be displayed.
Figure 1-ascii Code
2, UTF-16
Speaking of UTF must mention Unicode,iso trying to create a new hy
Learn Java for a few months, has been to public,private,protected,static,final keyword and with each other not too concerned about, today read the "Java Security coding standards" only to find the severity of the problem.Code that does not conform to the rule:A data member of the underlying data type of public (common). Should be changed into private form.Public
Refer to Sun's Java coding specification, semi-translation semi-comprehension.
Use blank lines to split blocks of code and add comments to code blocks;
A file a class (or interface) that places a private class behind a common class that references that class;
Source file composition: The declaration of a file comment, Package/import, class, or interface;
Environment Java Environment JDK1.8 installed mysql-5.6.38-winx64 idea2016 (64)The problem is this: Idea debugging Eclips project into the database and changing question marksFirst of all, Eclips and release of the project is not a problem, the first thought is the coding problem, so check the project and database code, but see that the code is UTF-8, the database is viewed through (navicat)But there are ar
xml| Coding | solve | Problems recently encountered a project, the need to save the declaration file in XML format, coding problems really let me a headache for a while. Now all unified into UTF-8 code. Specific operations in various languages
Here, I use the DOM for XML parsing, which should be simple.
1 customers first use VB to edit the form, generate a Apply.xml file.
In VB, use MSXML 4.0. If you don't
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.