What is ? - html

In html made by fckeditor i find the following character:
What is this character?

Looks like the ASCII code for Carriage Return, encoded as an XML character reference.

When you code in windows, and use "DOS/Windows" line endings, the your lines will end like this "\r\n".
In some xhtml editors, that "\r" is illegal so te editor converts it to "&#13".

Related

Proper Way to Escape the | Character Using HTML Entities

To escape the ampersand character in HTML, I use the & HTML entity, for example:
Link
If I have the following code in my HTML, how would I escape the | character?
Link
HTML Tidy is complaining, claiming an illegal character was found in my HTML.
I tried using ¦ and several other HTML entities, but Tidy says "malformed URI reference."
You wouldn't.
The problem (as the message says) is that the character is illegal in URLs. It is perfectly fine in HTML.
You need to apply encoding for URLs which would be %7C.
I don't know why tidy is complaining about it, but this character is not problematic in HTML nor in URL. | is not a reserved character and can be used in URL as is. You can percent-encode every character, but there is really no need for it.
What I would presume Tidy might be complaining is =. You have got two of them, the second being an invalid one.
There is no need to encode this character in HTML entities. It has no special meaning in HTML.

How to use HTML entity codes instead of character in HTML

I'm writing a post about quote characters like curly quotes. I want to be able to print this string “ to demonstrate html entity of this character “ but when I open the html page it turns to the character itself.
I think this has to do with the default charset of html5 documents set to UTF-8 but I've seen pages like this one using the raw code.
Is there any way to do this in html?
When you output “ it's converted to HTML entity ". So to output it as-is you must double encode it: “

How to insert these non-ascii characters as html content?

Any non-ascii representation is written as &#xYYYY.
As per below code,
Editor is Sublime Text.
How do I represent these emoticons in html?
I found this Sublime Text 3 Plugin to insert emojis into the editor.
https://packagecontrol.io/packages/Emoji
Is this what you are looking for?
As long as you save the file you're editing using the UTF-8 character encoding, and make sure it is delivered with a suitable content type header, such as Content-Type: text/html; charset=utf-8 you don't need to do anything at all.
Another option, as others have noted, is adding them as HTML entities instead. In order to do that you would need to know their character codes. How to do that differs between different environments, but there are multiple questions on SO about that.
Here's how you could do it in Python (Python 3, you'd need to use u"" strings in earlier versions):
chars = [
"😀",
"😐",
"😳",
"😫",
"💩"
]
for char in chars:
print("{}: &#{:02x};".format(char, ord(char)))
You can represent Emoticons in html as its unicode symbol formatted as 򪪪 (some unicode list)
<div>😁</div>
I am using sublime text as editor and when you see it on browser it should look like these:

Why doesn't nbsp display as nbsp in the URL

I am following a tutorial where a web application written in PHP, blacklists spaces from the input(The 'id' parameter). The task is to add other characters, which essentially bypasses this blacklist, but still gets interpreted by the MySQL database in the back end. What works is a URL constructed like so -
http://192.168.2.15/sqli-labs/Less-26/?id=1'%A0||%A0'1
Now, my question is simply that if '%A0' indicates an NBSP, then why is it that when I go to a site like http://www.url-encode-decode.com, and try to decode the URL http://192.168.2.15/sqli-labs/Less-26/?id=1'%A0||%A0'1, it gets decoded as http://192.168.2.15/sqli-labs/Less-26/?id=1'�||�'1.
Instead of the question mark inside a black box, I was expecting to see a blank space.
I suspect that this is due to differences between character encodings.
The value A0 represents nbsp in the ISO-8859-1 encoding (and probably in other extended-ASCII encodings too). The page at http://www.url-encode-decode.com appears to use the UTF-8 encoding.
Your problem is that there is no character represented by A0 in UTF-8. The equivalent nbsp character in UTF-8 would be represented by the value C2A0.
Decoding http://192.168.2.15/sqli-labs/Less-26/?id=1'%C2%A0||%C2%A0'1 will produce the nbsp characters that you expected.
Independently from why there is an encoding error, try %20 as a replacement for a whitespace!
Later on you can str_replace the whitespace with a
echo str_replace(" ", " ", $_GET["id"]);
Maybe the script on this site does not work properly. If you use it in your PHP code it should work properly.
echo urldecode( '%A0' );
outputs:

Invalid XML character §

I am having a issue with characters in my XML when I view it on a website. The character I want to be put in is § and what is coming out is § and my xml is <?xml version="1.0" encoding="UTF-8"?>. Any suggestions? Thanks!!
If you see “§” as “§”, then the reason is usually that the data contains “§” SECTION SIGN U+00A7 as UTF-8 encoded, as bytes 0xC2 0xA7, but it is being misinterpreted as being in an 8-bit encoding like windows-1252 or ISO-8859-1. Alternatively, an incorrect character code conversion (“double UTF-8 encoding”) has taken place.
Check out the HTTP headers of the web page. If they declare an encoding other than UTF-8, they may override the in-document declaration.
instead of the character § you can use its html code which is either &#167 or &sect.
have a look here Ascii Code, every ascii symbol has a dedicated html code that can be used instead of the symbol.
like the unbreakable space which i am sure you are familiar with: &nbsp