The encoding works well from database to webpages as '<p>Hi </p>' to '<p>Hi</p>'.
Actually, the text is rendered as a html format in a html page but it does not mean the wrapper '<p></p>' disappears.
'<', '>' are common special characters. If you fetch the value directly from the page as a html formatted text, you will probably meet an encoding problem.
Could you please tell me how you use google to search for this product (as a string 'Hi')?
If you are using a HttpWebRequest and append the 'product' as a query string, you might need to encode the text again using
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
26 Points
81 Posts
SEO text formatting issue
Jan 26, 2021 05:45 PM|JamieP1|LINK
Hi
Will give a small description of a problem i am facing but more information can be provided if required.
My database is saving text from a HTML editor as below
I output this data on a webpage using the below Decoding
The webpage itself looks fine when viewing in any browser. I see the text Hi and thats it.
I now search google for this product. The title is fine however the text that appears below the blue google text is displaying
So it displays a p> before the text Hi.
Thanks
Contributor
5961 Points
2466 Posts
Re: SEO text formatting issue
Jan 27, 2021 05:23 AM|KathyW|LINK
"The webpage itself looks fine when viewing in any browser. I see the text Hi and thats it."
What does the HTML code for that page look like near that output? View the page source and see.
Contributor
2840 Points
840 Posts
Re: SEO text formatting issue
Jan 27, 2021 07:17 AM|Sean Fang|LINK
Hi JamieP1,
The encoding works well from database to webpages as '<p>Hi </p>' to '<p>Hi</p>'.
Actually, the text is rendered as a html format in a html page but it does not mean the wrapper '<p></p>' disappears.
'<', '>' are common special characters. If you fetch the value directly from the page as a html formatted text, you will probably meet an encoding problem.
Could you please tell me how you use google to search for this product (as a string 'Hi')?
If you are using a HttpWebRequest and append the 'product' as a query string, you might need to encode the text again using
HttpServerUtility.UrlEncode
, which URL-encodes a string and returns the encoded string.Reference:
https://www.w3schools.com/tags/ref_urlencode.ASP
https://en.wikipedia.org/wiki/Percent-encoding
Best regards,
Sean
Member
26 Points
81 Posts
Re: SEO text formatting issue
Feb 03, 2021 10:20 AM|JamieP1|LINK
Hi
Due to time constraints, i used a Regex query to strip the text from any formatting which seems to have resolved the issue for now.
I can post the code should anyone require.
Thanks for your help anyway.