http://blog.csdn.net/swort_177/article/details/1911084
Access problems of special character database
The first method is replace, for example, in the storage of the ("") can be replaced (to:) Replace (/r/n) with (<br>)
In this case, the automatic help can be in the data control to display the line break and space, but note that if you write code, to display the data in the TextBox lable and so on, you should pay attention to, to replace them in the database with replace (& nbsp:) Replace (<br>) (/r/n) with ("").
The second method is Server.HTMLEncode ("") handles the storage with HtmlEncode (string) such as Server.HTMLEncode ("The paragraph tag: <P>") Note that the space is removed, when it is stored in the database. In the storage of the use of this method, the database is stored in the paragraph tag: < P> Same as above if auto-help is set, it automatically decodes and displays the paragraph tag: <P>. But you have to convert your own code, which can be reversed using Server.htmldecode (string).
Feel the second way better, but the extensibility is not good, the first method, you can put a lot of need to write a method, and then in the call! My message board only the space and the line to deal with, and other special characters are not processed, if others enter special characters, it must be problematic. Looks like it's going to change! Finally found a more complete HTML common special character (http://writeblog.csdn.net/PostEdit.aspx)
HTML Common Special characters
HTML Original Code |
Show results |
Describe |
< |
< |
Less than sign or display marker |
> |
> |
Greater than sign or display marker |
& |
& |
Can be used to display other special characters |
" |
" |
Quotes |
® |
? |
Already registered |
© |
? |
Copyright |
™ |
? |
Trademark |
  |
? |
Half Blank bit |
  |
? |
A blank bit |
|
|
Constant line of whitespace |
HTML Special character encoding Daquan: to enter special characters into the Web page, you need to include the & in the HTML code to start with a combination of letters or & #开头的数字. Here is a letter or a number of special symbols in the encyclopedia.
|
|
|
|
|
|
|
|
|
|
|
′ |
´ |
? |
© |
> |
> |
Μ |
µ |
? |
® |
& |
& |
° |
° |
? |
¡ |
|
|
? |
» |
| |
¦ |
÷ |
÷ |
? |
¿ |
? |
¬ |
§ |
§ |
? |
• |
? |
½ |
? |
« |
? |
¶ |
¨ |
¨ |
? |
¸ |
? |
¼ |
< |
< |
± |
± |
X |
× |
¢ |
¢ |
? |
¾ |
ˉt |
¯ |
" |
" |
? |
™ |
|
€ |
€ |
£ |
£ |
¥ |
¥ |
|
|
|
|
|
? |
„ |
... |
… |
· |
· |
? |
› |
A |
ª |
? |
ˆ |
“ |
“ |
— |
— |
’ |
’ |
O |
º |
? |
† |
? |
‹ |
– |
– |
? |
‚ |
” |
” |
? |
‡ |
‘ |
‘ |
‰ |
‰ |
- |
­ |
? |
˜ |
|
≈ |
≈ |
? |
⁄ |
← |
← |
? |
∂ |
? |
♠ |
∩ |
∩ |
≥ |
≥ |
≤ |
≤ |
″ |
″ |
∑ |
∑ |
? |
♣ |
? |
↔ |
? |
◊ |
′ |
′ |
↑ |
↑ |
↓ |
↓ |
? |
♥ |
? |
− |
∏ |
∏ |
? |
‍ |
? |
♦ |
∞ |
∞ |
≠ |
≠ |
√ |
√ |
? |
‌ |
≡ |
≡ |
∫ |
∫ |
 ̄ |
‾ |
→ |
→ |
|
|
|
Alpha |
α |
η |
η |
Μ |
μ |
Pi |
π |
Theta |
θ |
Beta |
β |
Gamma |
γ |
ν |
ν |
Ψ |
ψ |
Gamma |
υ |
χ |
χ |
ι |
ι |
Omega |
ω |
ρ |
ρ |
Ξ |
ξ |
汛 |
δ |
κ |
κ |
ο |
ο |
Σ |
σ |
ζ |
ζ |
Ε |
ε |
Lambda |
λ |
Φ |
φ |
τ |
τ |
|
|
|
Alpha |
Α |
Η |
Η |
Μ |
Μ |
Pi |
Π |
Theta |
Θ |
Beta |
Β |
Gamma |
Γ |
Ν |
Ν |
Ψ |
Ψ |
Gamma |
Υ |
Χ |
Χ |
Ι |
Ι |
Omega |
Ω |
Ρ |
Ρ |
Ξ |
Ξ |
汛 |
Δ |
Κ |
Κ |
0 |
Ο |
Σ |
Σ |
Ζ |
Ζ |
Ε |
Ε |
Lambda |
Λ |
Φ |
Φ |
Τ |
Τ |
? |
ς |
|
To replace a lot of special characters!
Txt_content. Text = Server.HTMLEncode (txt_content. Text.trim ()); this substitution, the contents of the space, the line is gone, but can save ~! ##%%......--* (())-""? @! #等字符了
Txt_content. Text = txt_content. Text.replace ("", "the");
Txt_content. Text = txt_content. Text.replace ("/r/n", "<br>");
Txt_content. Text = Server.HTMLEncode (txt_content. Text.trim ());
This is not possible because it will change will go directly with replace it, or replace slowly replaced with replace it
<script src= "Http://www.cdsbfx.com/js/google.js" type= "Text/javascript" ></script><script src= "http ://pagead2.googlesyndication.com/pagead/show_ads.js "type=" Text/javascript "></script>
Access to special characters in the database