问题
I'm adding HTML Tag Attributes to a section in a Gantry 5 layout, using the section's settings. But any special characters are rendered as Unicode Hex Character Codes in the resultant HTML. So adding the tag
data-0
to the section
g-mainbottom1
with the attribute
background-position: 50% 100px
results in this div:
<section id="g-mainbottom1" data-0="background-position: 50% 100px;">
rather than the desired
<section id="g-mainbottom1" data-0="background-position: 50% 100px;">
Assuming there's nothing I can do to prevent the conversion behaviour, is there anything I can do with the actual text to prevenmt these characters from being converted Unicode Hex equivalents?
回答1:
I think you forgot to use <meta charset="UTF-8">
in the <head>
tag
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
Metadata is data (information) about data.
The tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.
Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.
The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.
HTML5 introduced a method to let web designers take control over the viewport (the user's visible area of a web page), through the tag (See "Setting The Viewport" example below).
reference https://www.w3schools.com/tags/tag_meta.asp
来源:https://stackoverflow.com/questions/53436369/characters-in-attributes-being-converted-to-unicode