I'm building a simple website example where I added an image. I'm using textedit on mac. However, special characters are being added to the file when I look in Chrome's inspector.
In textedit I type
<img src =“images/nicole.png”>
But it displays as
<img src="“images/nicole.pngâ€"">
Why is this happening?
The quote you are currently using is a Unicode version (Most likely the Chinese version). That's why it is showing as those weird chars. Try to copy and paste this " into your code instead of typing them in should fix it. You might want to check your IME setting or text editor setting to prevent it in the future.
In the TextEdit preferences (TextEdit menu > Preferences), uncheck "Smart quotes" under Options.
You will have to go through and replace all of them.
Related
Why do all new WordPress posts with a graphic or link show the corresponding HTML code instead of the image or link?
When I create a new post I use the visual editor, and I press Add Media, then select a graphic that I have uploaded, and the graphic shows as expected in the visual editor. I then press Preview and the full “img” HTML text shows in the preview window instead of the graphic. When inspecting the Preview window’s img element, it has quotes around the whole img element, thus treating it as text. The same issue happens when inserting a link – the full “a” HTML text is displayed.
This happens for me on the the default install of WP 4.7.3. Installed WP 4.7.3 to a fully patched Windows 7 64-bit PC. Apache 2.4.23, PHP 7.1.3, MySQL 5.7.15 with utf8mb4_general_ci collation (also tried utf8_default_collation). No plugins are active (I only have the 2 default plugins installed). No themes other than 3 default, and Twenty Seventeen is active. Using Chrome 57/Safari/Firefox all do the same thing.
I’ve installed on another Windows PC and get the same issue. If I press Add Media and add the graphic, then switch to the text editor, it shows the “img” element text correctly in the editor. When I preview this text view or publish it, it shows the full “img” element as text just like publishing from the visual editor view. If I manually enter an “a” link element, it shows the full “a” HTML not just the link’s visible text. All these scenarios show the HTML instead.
Restarted Apache, cleared cache, checked all Apache and PHP logs and no errors show in Chrome console.
I found this problem was caused by the filter setting in the php.ini file. From a previous PHP application the following setting was set:
filter.default = full_special_chars
This wrapped the post information in quotes. Commenting out this setting solved the problem.
So I am starting to learn HTML and I am running into some weird things. I am trying to just use a link to go to a specific webpage. I typed in the code but it gave me an error saying it could not find the link on my desktop. However, when I copy and paste the exact same code from a website it works fine. Here are the two codes so you can compare, the top one works and the bottom one doesn't.
This is a link
<a href=“https://www2.housing.wisc.edu/dining/ordering/”>This is a link</a>
I was wondering if it had to do with the slightly different quotation marks, if it is I am still not sure how to fix it, because the computer autocorrects the quotations to that format.
If the comments haven't answered your question yet, yes you need to use a slightly different quotation mark. HTML only accepts the single typewriter (non-curly) quotation mark ' ' or the double one " ". Or, in your case, you can choose not to use quotes at all, unless the value contains a space or equal sign.
What are you using? Office? Open up a text editor like Notepad or download Notepad++ (free) and you won't have to deal with auto correct.
In any case the code you posted above works for me.
Open Notepad.
copy and paste
<html>
<body>
This is a link
</body>
</html>
click SAVE AS and instead of saving as a .txt file save as a .html to your Desktop.
Double click the newly created file, and it should open in a web browser.(If not you have to right click on the file and select "open with..." and choose a web browser
Click the link.
Does sublime text3 has file path prompt?
for example :
<img> tag
src="img/apple/pic.jpg"
after img/ it can automatic prompt
Sublime Text does not come with these features preinstalled. However, it's very likely that a plugin such as this one (I haven't tried it) will solve your issue. If it's an image you use like all the time, you can make it a snippet if you'd like so you could type apic for example, press tab, and it would expand. Otherwise, try the plugin.
Sometimes Sublime Text 2 will recognize my code with its color scheme and other times it won't. I do a lot of pasting code into the code editor and editing it, but I rarely write code in it, mostly editing my older code. Its really helpful having the color scheme!
You can also set the coding language by clicking the bottom right corner "Plain Text" to open a list of languages to choose from. Click the relevant language and the Sublime will do the coloring according to your selection.
If you are just opening new files and pasting text in, the default syntax is "Plain Text", thus no highlighting. You can set the syntax in the buffer by opening the command palette and searching for "Set Syntax: ". If that isn't what is happening, please try to give more information.
-skuroda
Go to a color page and copy just the < ? and php from the top. Go to the white text page and highlight/paste.
This worked for me. i had a problem with Arduino color coding but now i solved that with the help of this trick. You can also set the coding language by clicking the bottom right corner "Plain Text" to open a list of languages to choose from. Click the relevant language and the Sublime will do the coloring according to your selection.
Javascript Syntax was not working for me, so changed to Java. Color shading appeared.
On a Mac, I created a file with some very simple html, e.g. <h1>my web page</h1> I save it as .html. I start firefox or Opera and I use open file, but I just see the content as html source, e.g. I see <b> tags, etc.
If you want all the code here it is:
<html>
<head>
</head>
<body>
<h1>My Web Page</h1>
</body>
</html>
Edit: 'Rich text' format was the issue. See my answer below.
Shad was actually on to the right answer here.
The problem was that I was using the standard mac text editor - textedit - and it was saving the document type as rich text formatting (the standard). I had to go into textedit preferences and make change the default formatting for a new document from Rich text to Plain text. This fixed the problem!
As this was a stupid problem, yet not obvious to most I'll post the screen shot of where you change that default new document preference in textedit prefs.
Probably because of some silly header stuff. Browsers use the header information to decide how to render it, not the extension, I think. You know, there's a tiny chance that any file- exe, jpg, png, txt- could actually appear as valid HTML because they're both just files at heart.
Open the "Get Info" of the file by right clicking on the file (or control click) and selecting Get Info. Under the section titled Name & Extension un-check Hide extension. You will see that mac has added an extension (usually .txt), just remove that extension and close