JB8 a JSP file to write, save the reason for the bug and modify

Source: Internet
Author: User
Tags character set lowercase modify versions
This error usually occurs when you write and save JSP files in JB8 (prompts in the status bar)
Com.borland.primetime.util.AssertionException:gbk
The JSP file is not saved correctly.

The personal modification method is as follows:

This problem I am using JB8 to write JSP file when found, now I have basically solved (but changed the JDK class library some code)

First, let me explain why:

JB8 This problem only appears in the JSP file, while the Java code is not a problem
When we write a program with JB (all JB8 Previous versions), the Code for the project (Encoding) should be GBK (note that uppercase)
So when we write Java code, we use GBK, and in previous versions of JB8, Java files and JSP files were used for project encodings.

(such as: GBK), so all files are written in GBK

JB8 to the Java file and JSP files separated, Java continue to use the project encoding, and JSP based on the JSP file header
<%@ page contenttype= "text/html;charset=[encoding]"%>
[Encoding] (such as GBK, gb2312) to read, write, and write files, and if not, use iso-8859-1 (this coded write

Law also has a problem, there will be a description of the modified method, but here with GBK code to write the JB8 inexplicably GBK changed to lowercase

GBK (Borland programmer write wrong or other reason?!) Who knows! , and there is no such code in the JDK class library (Java is a big

lowercase), so the above error occurs:
Com.borland.primetime.util.AssertionException:gbk

Workaround:
Before using my method of modification, everyone was wrong to find some information about the Java character set (supported encoding) (Forum Elite Area has information)
I modify the JDK's class library here, do not modify JB8 code (JB8 too large, find difficult to find)
In the JDK class library, the encoding alias conversion class is sun.io.CharacterEncoding (in the Rt.jar package, the JDK directory is jdk1.4\jre\

Lib

This resolves the alias,
Java is supported by more coding, such as: ISO8859_1,GB2312,GBK, and Java is case-sensitive, if I put iso8859_1

Written Iso8859_1,java will make mistakes, just like JB8 GBK wrote GBK on the wrong, that Java wrong some fault-tolerant processing, when he read

Some encodings that are not supported by themselves are going to look for sun.io.CharacterEncoding and see if there are any corresponding code conversions,

If there is a standard encoding, here we write is not standard code to be encoded alias, and the code alias may have

A lot (this is related to the operating system, such as Iso8859_1 has a lot of writing: iso_8859-1,iso8859_1)
Alias specific English name parsing I don't remember, I'm calling it an alias by my own understanding.

And then I'll give you a quick overview of how sun.io.CharacterEncoding converts aliases.
It is simple to say that a hashmap is used to make the corresponding table of key and value
The sun.io.CharacterEncoding part is encoded as follows (compiled with JAD)
((HashMap) (obj)). Put ("Us-ascii", "ASCII");
((HashMap) (obj)). Put ("ASCII", "ASCII");
((HashMap) (obj)). Put ("646", "ASCII");
((HashMap) (obj)). Put ("iso_646.irv:1983", "ASCII");
((HashMap) (obj)). Put ("ansi_x3.4-1968", "ASCII");
((HashMap) (obj)). Put ("iso646-us", "ASCII");
((HashMap) (obj)). Put ("Default", "ASCII");
((HashMap) (obj)). Put ("Ascii7", "ASCII");
((HashMap) (obj)). Put ("8859_1", "iso8859_1");
((HashMap) (obj)). Put ("iso_8859-1:1987", "iso8859_1");
((HashMap) (obj)). Put ("iso-ir-100", "iso8859_1");
((HashMap) (obj)). Put ("Iso_8859-1", "iso8859_1");
((HashMap) (obj)). Put ("Iso-8859-1", "iso8859_1");
((HashMap) (obj)). Put ("Iso8859-1", "iso8859_1");
。。。。。

The corresponding table is larger, but it's not difficult to find.
It is easy to find the cause of the problem against the previous jb8, and there is no GBK and GBK corresponding to the corresponding table!!!!
Then we'll know how to solve it, and add!!! ourselves.
((HashMap) (obj)). Put ("GBK", "GBK");
("I don't know if I remember right now") and then I found out that JB8 also wrote a wrong encoding iso-8859_1, which is not in the corresponding table.

, we suggest that we also add:
((HashMap) (obj)). Put ("Iso_8859-1", "iso8859_1");

Then compile your own sun.io.CharacterEncoding and add it to JB8 's jdk1.4 Rt.jar package.
(How to do this, please refer to Jar.exe's instructions, it is helpful to run the jar in the command window)


JB8 will not go wrong in the future! haha:)

If you do not agree with me or have a better solution please point out, welcome to discuss.

Related Article

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.