i like to assign html codes to String variable

  Dim code As String
  code= "  <meta http-equiv="Content-Type" content="text/html; charset=windows-1254">  "

i think i am getting this error because of double Quotation marks
"character constant must contain exactly one character."

how can i assign it to a string?

Re: String variable to assign a value 80 80
Imports System.Web
Dim encoded As var = HttpUtility.HtmlEncode(unencoded)
Re: String variable to assign a value 80 80

or:

Also, you can use this if you don't want to use the System.Web assembly:

var encoded = System.Security.SecurityElement.Escape(unencoded)

Per this article, the difference between System.Security.SecurityElement.Escape() and System.Web.HttpUtility.HtmlEncode() is that the former also encodes apostrophe (') characters.

Re: String variable to assign a value 80 80

If you want to use the format you gave in the OP you just have to convert the embedded double quotes to double double quotes as follows

code= " <meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1254""> "

I may be mistaken on this but you also may be able to replace the embedded quotes with single quotes as in

code= " <meta http-equiv='Content-Type' content='text/html; charset=windows-1254'> "
Re: String variable to assign a value 80 80

thanks all off you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.