On a CMS TYPO3 website I created 15-20 years ago and have been updating regularly, a few days ago, noticed a new problem: that the accented characters were all displayed badly. I hadn't changed or updated anything for a few weeks. How do I get it back to how it was?
That sounds like a bad UTF-8 encoding of your database.
Normaly this should have been detected and cleared some years ago when TYPO3 switched over to UTF-8 connections in general. Up to then it was possible to use the database in any encoding and force UTF-8 usage in the connection. in this way UTF-8 characters were stored in e.g. iso-latin fields. one missing forced usage and you ended up with a scrambled page. especially if you transfered the data with a dump you could destroy your data.
As this should have been happened years ago, another problem could have occured:
Maybe your (updated?) browser can't decide which encoding your site is using and guessed wrong.
Maybe you need to provide a proper encoding information in your HTML output.
ADD:
A proper encoding information may look like <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> or just <meta charset="utf-8"> as meta information in the HTML header.
Normaly such a header is sent by TYPO3 by default.
Related
I am using netbeans 7.4 for PHP programming. I have a web form and need to insert a non-English language (Sinhalese)to the interface. I have installed various fonts of this language in my PC and my browser (firefox) renders these fonts properly, because I have viewed local websites using the browser.
Netbeans shows this font as squares and when I run it in the browser something like this කොහොමà·à¶ºà·’is displayed. (Not squares). What is the reason for this? I really do not want to netbeans to show those characters. If the browser can render them, that would be enough.
Answering my own question :)
If you want to display unicode in your browser, you have to include below meta under <head> tag of your html part. Otherwise it won't render non-English content. This worked for me, but netbeans still shows squares for non-English context. I don't mind it since I am using non-english only for user interfaces
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Hope this will help a future reader
I want to ask you, as a beginner, what basic settings for the document encoding are you doing with UTF-8?
An example how I do it below and am asking about repair if something is wrong. I want to rely on all devices in different browsers with different user settings will render the text as it should, so I will do the following:
I use Notepad ++ , first in the Format tab choose "change the encoding to UTF-8 (if its already not)";
Because I use <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> mostly or . <!DOCTYPE html>, then select the correct attribute for the meta tag in the head, so either <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> , respectively . <meta charset="UTF-8" />
I'm concerned mainly about the Czech characters
Am I right or isn´t it that simple if I expect cooperation between HTML, PHP or JS, maybe MySQL?
Thank you for your answers and sorry for incomplete English.
If you read text from a Database make sure that it is set to utf8 and that the columns are as well. Then you can use SET NAMES UTF8 to make sure the connection encoding is utf8 as well. Just make it your first query to the databse.
so i am a bit stucked on this and i am also a bit lost. I have a GWT App and all .java files and everything is encoded in cp1250 (as default, from container) i tried to change encoding at my .html (because everything was in UTF-8)
<meta http-equiv="content-type" content="text/html; charset=cp1250">
and also web.xml file,appengine-web.xml file and .gwt.xml file
<?xml version="1.0" encoding="utf-8"?>
to cp1250 but i cant get the encoding right, i need to display and store characters like áéžčťíóšľĺ... i also tried to change encoding of some .java files to ISO--8859-1 as well as in the .html and .xml files but nothing worked. I dont know EXACTLY what to change, so maybe thats my problem.
I use RPCs for text(String) transfer so i can get those characters from input to server side and write them with println() correctly, but i cant save them to datastore correctly.
So, is there a way to store such characters or show them in Labels etc. ? If yes, what should i do exactly ? Or storing in datastore and showing them only in com.google.gwt.user.client.ui.HTML would be sufficient as well, thanks a lot for your time.
SOLUTION
Ok so basicaly what i was doing wrong was that default cp1250 enxoding. Just set the encoding on everything to UTF-8 and displaying and storing will be just fine, it will convert some of special characters in your code to "?" when u change it, but with a little bit of extra work you can change it back.
Sorry for the dumb question, but i though UTF-8 wasnt way to go... idk why :P
I´m having problems getting correct names of files uploaded to a NancyFx web.
I´m Spanish and we have no common characters like
ñ á é í ó ú... in uppercase and many more.
When I pick the file already uploaded from this.Request.Files.FirstOrDefault().Name then the names are always bad encoded.
I tried a lot of transformations with no success.
Any suggestions are highly appreciated.
Does your HTML page contain a
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
within the <HEAD> element?
I have same experience with Korean file name.
And after some more googling, I found this nancyfx github issue: https://github.com/NancyFx/Nancy/issues/1850
It's fixed bug. (but I am using nancy 0.x version, so it did not helped me.)
what type of encoding or what do I have to do to make my web site display properly the text with German characters like this: Käse and not like this: K�se ?
Here is what I use for doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
and here is what I use for encoding:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
the collation in mysql that I use is utf8_general_ci, I have never done web sites with other languages except for english (from scratch). I dont know what I am missing!
Thank you for your time!
Your encoding choise looks fine.
There is just two steps left: You have to make sure that the content type in the HTTP header also says the same, and you have to make sure that what you actually send is encoded using UTF-8.
UTF-8 should used for sites that cater for many languages, so is suitable for your needs.
The meta tag is correct too, though you may want to ensure that the server is sending the right Content-Type header.
Ensure that the HTML file is also encoded with UTF-8 and not ASCII or another codepage.
In general, you need to ensure that all steps from the DB to the browser use UTF-8 (so, DB columns are UTF-8, transferred to the server as UTF-8, rendered as UTF-8, transferred to the browser as UTF-8 with the right headers and meta tags).
From my expiriense, for utf-8 to work right:
MySql data needs to be in some of the "utf-8" collations
The meta tag needs to define charset as "utf-8"
The MySql connector needs to be set to "utf-8" (for php, its mysql_set_charset)
The server-side file (*.php or the like) needs to be saved in utf-8 (not actually necesary, but it saves some pain)