The problem with displaying the Cyrillic alphabet - html

I’m writing a website. I do this without the help of any CMS, only naked HTML 5 and CSS 3. I wrote a web feedback form. A person enters their name, and when you click “Send”, the mail client opens, where the name is printed in incomprehensible characters. How can I fix this?
The code in the page header is as follows: <meta charset= "UTF-8">
I tried changing the encoding, but it didn’t help. I configured Apache by default to UTF-8. The result, too, is zero.

Related

Black diamonds with question marks instead of pound sign causing issues

have a site that pulls in data from a MS SQL database and in there the user inputs the price of the property (i.e. £159,950) and on the desktop site this pulls in fine but they have a dedicated mobile site (their choice, going responsive on next re-design) and the pound sign won't pull in, instead it shows the black diamond with a question mark in it. The bizarre thing is though, if I refresh the page the pound sign appears fine so really baffled by it to be honest. When I view the mobile URL in a desktop browser the £ sign shows fine also. Really annoying me now. I have the following in the header:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
and have tried alternatives but to no avail yet. Any ideas? Seems odd that once you refresh it works. You would think it would or it wouldn't. Thank you for any advice.
Check what your server is sending in the HTTP headers. It should be configured to send a charset: header (with the correct value) instead of relying on meta tags in the page code.
NOTE that in this day and age, using any charset other than utf-8 is asking for trouble (makes the site incompatible with any language other than the one for which your specific charset is suited, creates problems with user input when they type anything other than base ASCII characters, prevents using a multitude of useful characters such as emoji, etc.). Consider switching to utf-8 for the entire site.
Try replacing all occurrences of £ with its HTML entity, £.
Ended up using this to fix it by replacing the £ sign with the correct HTML code for it.
<%
sValue = rs.Fields.Item("displayedprice").Value
sValue = replace(sValue, "£","£")
%>
<h3><span class="price"><%=sValue%></span></h3>
Thanks for those that offered help, much appreciated.

UTF-8 encoding only working in index.html?

I have a bit of an odd problem here that I cannot figure out. I have two pages: index.html and index2.html. The utf-8 character encoding works fine in index.html but it does not work in index2.html. For example the following paragraph:
Ex-Fleet Foxes drummer Josh Tillman struck out on his own (he was already a singer/songwriter in his own right prior to joining Foxes) and rechristened himself professionally as “Father John Misty.”
The quotes around Father John Misty display perfectly in index.html but appear as diamonds with a question mark on index2.html. Both pages have this meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I can even copy and paste the exact same source code from index.html into index2.html and it still does not work. Is there something I need to place into a .htaccess file? I already checked the permissions on both .html files are they are identical. I'm at a loss as to what else the problem might be.
If the result shows the Unicode replacement character �, that means whatever is reading the document is trying to interpret it as Unicode (usually UTF-8), but encountered a byte sequence which is not valid in that encoding.
In other words: the browser is trying to do the right thing, the document is not actually UTF-8 encoded. Check the settings in your editor.

Encoding issue in Mailchimp emails

I created a Mailchimp template for the email newsletter of the company I work for. There's an issue with some links and I can't work out how to fix them.
I add a link into the email like so:
Contact Us
And the link appears fine, but when clicked within Gmail it takes you to the site's 404 page, even though the URL is (on the surface) correct.
After clicking the link, the URL displayed in the address bar is http://www.nameofcompany.com/contact-us.php, which is the correct URL and which when typed into the address bar directly goes to the correct page. But when I visit this URL from the email, then copy and paste it from the address bar into a new email in Gmail, I see: http://www.nameofcompany.com/contact%E2%80%90us.php
So this appears to be an issue with character encoding. I have no idea how to fix it though.
Here's the doctype, charset etc from the HTML of the email.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The strangest thing is, most URLs in the email work perfectly fine, even those with dashes in.
What's causing this issue and how can I fix it?
Cheers
Okay, fixed it. I found the template on Mailchimp and used "Edit this template's code" to edit the HTML within my browser. Then I found the tag that was causing the trouble, deleted it and typed it back out again. Bit of a crude fix and I'm not sure why the problem originally arose but it's done the job!
E2 80 90 is the Unicode byte sequence for the multibyte hyphen character and you should be using the ASCII one.
Which app. do you use for coding your html files? This has to do with the encoding of the hyphen. Try using a simple text font if you are given such option at your code editor (such as Courier).
I don't know why hyphen was encoded into 3 bytes here - usually non alpha/num characters in URL are encoded into one byte.
Try replacing hyphen with %2D, so that hyphen won't be transformed into %E2%80%90.

Unicode is not shown in meta tag

I have used unicode in my website's meta tag as follows.
<meta property="og:title" content="ශ්‍රී ලංකා" />
But when I get view source in browser, it is shown as follows.
<meta property="og:title" content="????????" />
How can I avoid this?
Thank you.
With an editor like Notepadd++, you must change the file encoding to UTF-8:
The Sinhala characters in your file have been converted to question marks somewhere in the process of uploading to the server or in server actions. They are actual question marks “?”, U+003F, not problem indicators used by browsers or source viewers. Question marks also appear near the very end of the page in visible content, line 445: ?????
The page appears to be served simply from a static HTML file by an Apache server, with no special server-side technology (though one cannot be sure, when looking from outside). This suggests that something has gone wrong in the upload process, like incorrect character code conversion (assuming you have checked that the file in your authoring system is UTF-8 encoded and displays correctly). This may happen if you transfer a file in “text mode” or “Ascii mode”, so I suggest uploading it again, in as raw mode as possible.

Why do symbols like apostrophes and hyphens get replaced with black diamonds on my website?

A website I've made has a few problems... On one of the pages, wherever there's an apostrophe (') or a dash (-), the symbol gets replaced with a weird black diamond with a question mark in the center of it
Here's what I mean
It seems this is happening all over the site wherever these symbols appear. I've never seen this before, can anyone explain it to me?
Suggestions on how to fix it would also be greatly appreciated.
See http://test.rfinvestments.co.za/index.php?c=team for a clear look at the problem.
It's an encoding problem. You have to set the correct encoding in the HTML head via meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
Replace "ISO-8859-1" with whatever your encoding is (e.g. 'UTF-8'). You must find out what encoding your HTML files are. If you're on an Unix system, just type file file.html and it should show you the encoding. If this is not possible, you should be able to find out somewhere what encoding your editor produces.
You need to change your text to 'Plain text' before pasting into the HTML document. This looks like an error I've had before by pasting straight from MS word.
MS word and other rich text editors often place hidden or invalid chars into your code. Try using — for your dashes, or ’ for apostrophes (etc), to eliminate the need for relying on your char encoding.
I have the same issue in my asp.net web application. I solved by this link
I just replace ' with ’ text like below and my site in browser show apostrophe without rectangle around as in question ask.
Original text in html page
Click the Edit button to change a field's label, width and type-ahead options
Replace text in html page
Click the Edit button to change a field’s label, width and type-ahead options
Look at your actual html code and check that the weird symbols are not originating there. This issue came up when I started coding in Notepad++ halfway after coding in Notepad. It seems to me that the older version of Notepad I was using may have used different encoding to Notepad's++ UTF-8 encoding. After I transferred my code from Notepad to Notepad++, the apostrophes got replaced with weird symbols, so I simply had to remove the symbols from my Notepad++ code.
If you are editing HTML in Notepad you should use "Save As" and alter the default "Encoding:" selection at the botom of the dialog to UTF-8.
you should also include-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
This un-ambiguously sets the correct character set and informs the browser.
I experienced the same problem when I copied a text that has an apostrophe from a Word document to my HTML code.
To resolve the issue, all I did was deleted the particular word in my HTML and typed it directly, including the apostrophe. This action nullified the original copy and paste acton and displayed the newly typed apostrophe correctly
What I really don't understand with this kind of problem is that the html page I ran as a local file displayed perfectly in Chromium browser, but as soon as I uploaded it to my website, it produced this error.
Even stranger, it displayed perfectly in the Vivaldi browser whether displayed from the local or remote file.
Is this something to do with the way Chromium reads the character set? But why only with a remote file?
I fixed the problem by retyping the text in a simple text editor and making sure the single quote mark was the one I used.