| |

VerySource

 Forgot password?
 Register
Search
View: 641|Reply: 5

A string problem

[Copy link]

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-13 14:00:01
| Show all posts |Read mode
A string problem

if:

<ffff> <br> <gggggg> <111>

Write the above line into the database. That line has been stored in the database, but after reading it out
<ffff> <br> <gggggg> These cannot be displayed
<111> These can be displayed


? ? ? ? ? ? ? ? ? ? ?
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 China

Post time: 2020-6-8 15:45:01
| Show all posts
string content = Server.HtmlDecode("<ffff><br><gggggg><111>");
HtmlHolder.Controls.Add(new LiteralControl(content));
HtmlHolder sets the ID of <TD> of Runat=Server for the first foreground
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-6-11 18:15:01
| Show all posts
no, sorry?
Reply

Use magic Report

0

Threads

24

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-6-12 11:30:02
| Show all posts
<gggggg>
I can't display it in the data! I have the same problem!

Finally, I only added spaces in the middle <gggg> to do so.

Help LZding! I hope an expert will answer!
Reply

Use magic Report

0

Threads

43

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-6-17 10:15:01
| Show all posts
Write a class to replace special characters

Write to the database and call HTMLEncode, and output to call Htmldecode

    Public Shared Function HTMLEncode(ByVal fString As System.Object) As String
        If Not IsDBNull(fString) Then
            fString = Replace(fString, ">", "&gt;")
            fString = Replace(fString, "<", "&lt;")
            fString = Replace(fString, "'", "''")
            fString = Replace(fString, "", "&nbsp;")
            fString = Replace(fString, Chr(13), "")
            fString = Replace(fString, Chr(10), "<BR>")
            Return fString
        Else
            Return ""
        End If
    End Function

    Public Shared Function Htmldecode(ByVal fString As System.Object) As String
        If Not IsDBNull(fString) Then
            fString = Replace(fString, "&gt;", ">")
            fString = Replace(fString, "&lt;", "<")
            fString = Replace(fString, "&nbsp;", "")
            fString = Replace(fString, "<BR>", Chr(10))
            Return fString
        Else
            Return ""
        End If
    End Function
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-6-18 16:30:01
| Show all posts
I have tried it, still not work
There is server.HtmlEncode and server.HtmlDecode

But still the same
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list