Why is ® being rendered as ® without the bounding semicolon
Although valid character references always have a semicolon at the end, some invalid named character references without a semicolon are, for backward compatibility reasons, recognized by modern browsers' HTML parsers.
Either you know what that entire list is, or you follow the HTML5 rules for when &
is valid without being escaped (e.g. when followed by a space) or otherwise always escape &
as &
whenever in doubt.
For reference, the full list of named character references that are recognized without a semicolon is:
AElig, AMP, Aacute, Acirc, Agrave, Aring, Atilde, Auml, COPY, Ccedil,
ETH, Eacute, Ecirc, Egrave, Euml, GT, Iacute, Icirc, Igrave, Iuml, LT,
Ntilde, Oacute, Ocirc, Ograve, Oslash, Otilde, Ouml, QUOT, REG, THORN,
Uacute, Ucirc, Ugrave, Uuml, Yacute, aacute, acirc, acute, aelig,
agrave, amp, aring, atilde, auml, brvbar, ccedil, cedil, cent, copy,
curren, deg, divide, eacute, ecirc, egrave, eth, euml, frac12, frac14,
frac34, gt, iacute, icirc, iexcl, igrave, iquest, iuml, laquo, lt,
macr, micro, middot, nbsp, not, ntilde, oacute, ocirc, ograve, ordf,
ordm, oslash, otilde, ouml, para, plusmn, pound, quot, raquo, reg,
sect, shy, sup1, sup2, sup3, szlig, thorn, times, uacute, ucirc,
ugrave, uml, uuml, yacute, yen, yuml
However, it should be noted that only when in an attribute value, named character references in the above list are not processed as such by conforming HTML5 parsers if the next character is a =
or a alphanumeric ASCII character.
For the full list of named character references with or without ending semicolons, see here.
How to prevent PHP from renaming '×' to 'x' symbol?
You have to escape that string, because & is a special symbol in HTML.
echo htmlspecialchars('?hash=123&rid=111×tamp=123');
More information on the PHP site: https://www.php.net/manual/en/function.htmlspecialchars.php
Weird characters coming being rendered in browser
Did a little bit more digging, and you're not alone: Calendar Issues Thread.
It seems that adding &hl=en to the end of your URLs should fix this. Like so: http://www.google.com/calendar/feeds/kbfj3n6iuc3u822d5omj06vt38%40group.calendar.google.com/public/basic?max-results=5&orderby=starttime&sortorder=ascending&callback=embedEvents&alt=json-in-script&futureevents=true&hl=en
I tried this and it fixed the raw data for me.
¤cy being change to ¤cy=GBP
You need to HTML-encode the &
character as &
.
Dim str = "<a target=""_blank"" href=""https://....?instId=" & ID & "&amount=" & Uri.EscapeDataString(amount) & "¤cy=" & Uri.EscapeDataString(paypalcurr) & etc
Is HtmlParser.entityref actually a valid regex for matching html entity references?
The syntactic production for reference end
reads:
[61] reference end =
( refc | ;
RE ) ? (13) CR
That means that the following are recognized as reference ends:
- A REFerence Close delimiter (
;
in the reference syntax), as you expected - A Record End
- Nothing (note the use of the
?
metacharacter after the close parenthesis, meaning that both REFC and RE are optional)
If nothing is used as a reference end, the reference ends at the first non-name character after the name start character, as required by the rules of the reference recognition mode that has been entered at the Entity Reference Open delimiter (ERO &
).
Note also that ERO is only used for the general entity reference production.
Using × word in html changes to ×
You need to escape:
<div class="test">×</div>
And then read the value using text() to get the unescaped value:
alert($(".test").text()); // outputs: ×
Login to page with CURL
You need to use CURLOPT_COOKIEJAR
and CURLOPT_COOKIEFILE
for this.
curl_setopt($handle, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($handle, CURLOPT_COOKIEFILE, 'cookie.txt');
This will keep all the cookies in cookie.txt
and while making a new request cookies will be taken from same cookie.txt
file. This way you'll be able to maintain the session on successive HTTP requests.
Hotkey to end the line with a semicolon and jump to a new line in Sublime Text 2
Best solution for this is recording a macro on Sublime Text and then assigning it to a keyboard shortcut. Follow these steps:
- Create a line such as alert('hello') and leave the cursor right
after letter 'o'. - Then go to Tools > Record a Macro to start recording.
- Press Command+→ to go to the end of line.
- Press ; and hit Enter
- Stop recording the macro by going to Tools > Stop Recording Macro
- You can now test your macro by Tools > Playback Macro (optional)
- Save your macro by going to Tools > Save Macro (ex: EndOfLine.sublime-macro)
Create a shortcut by adding this between the square brackets in your
in your Preferences > Key Bindings - User file:{
"keys": ["super+;"], "command": "run_macro_file", "args": {"file": "Packages/User/EndOfLine.sublime-macro"}
}- Now, every time you hit Command+;, it will
magically place the semicolon at the end of current line and move the cursor to the next line.
Happy coding!
Related Topics
When Printing Tables in Google Chrome, Content Overlaps Header
CSS Stretch Textbox to Fill Remaining Space
Ie Compatibility Mode: 'X-Ua-Compatible' Tag 'Edge'
Semantically, Which Is More Correct: a in H2, or H2 in A
Select First Occurring Element After Another Element
CSS Way to Horizontally Align Table
CSS Margin: 0 Is Not Setting to 0
Autoplay Audio on Mobile Safari
How to Get Equal Width of Input and Select Fields
Jquery - Follow The Cursor with a Div
How to Hide Text Field in HTML File Upload
Linethrough/Strikethrough a Whole HTML Table Row
Difference Between Onblur and Onchange Attribute in HTML
How to Float a Div Over Google Maps
Overflow Behavior After Using CSS3 Transform
Making an Svg Image Object Clickable with Onclick, Avoiding Absolute Positioning