I have a problem with a WordPress site (it's in Swedish). For some reason I can't use all characters when I'm writing posts - the characters å, ä and ö become Ã¥ ä ö. The site is a webshop and I have the Woocommerce plugin installed. The same problem with åäö occurs in the long product descriptions of Woocommerce.
Anyone know what I can do to solve this? The character encoding in WordPress admin panel is set to UTF-8 and so is the database charset in wp-config.
In the database in phpmyadmin the collation of the wp-posts tables are set to "utf8_general_ci". Is that the problem?
This thing has never happened to me before, even though I have built a lot of WP sites in the past. Therefore I don't know what to do. Maybe the solution is simple but I want to know what I'm doing before doing anything so I don't risk messing up the site.
Would really appreciate some help with this, thanks.
When "national special characters", ie. non-ASCII characters, are displayed wrong, you probably have an error related to charset. The easiest way to fix this is usually to make sure that you are using UTF-8 everywhere.
(For Swedish in particular, you can use ISO-8859-1 (worst), ISO-8859-15 (better) or UTF-8 (best).)
You need to use the same charset everywhere, from the database to the HTML declaration.
In your theme's header.php file, please make sure that the declared charset is
UTF-8.
In your text editor or on your server, please make sure your theme files are being saved as UTF-8.
In MySQL, please make sure that the table schema is set to use utf-8.
In MySQL, please make sure that connections default to use UTf-8: mysql --default-character-set=utf8
In PHP, try setting the connection to utf-8 with mysqli_set_charset
In order to fix the Character Encoding Mismatch Problem in WordPress,
Open the ‘wp-config.php’ file in a text editor(the wp-config.php file can be found on the directory where you installed WordPress).
Find the following two lines and comment them out:
define(‘DB_CHARSET’, ‘utf8′);
define(‘DB_COLLATE’, ”);
They should look like the following after you comment them out:
//define(‘DB_CHARSET’, ‘utf8′);
//define(‘DB_COLLATE’, ”);
Now upload the updated ‘wp-config.php’ file to your webhost.
This character encoding problem can happen after a database upgrade too so it doesn’t hurt to keep this trick in your mind just in case.
In another case, if you are using PHP Dom (loadHTML) somewhere, there is a need to load HTML as UTF-8. I have fixed it by:
Replacing
#$dom->loadHTML($html);
to
#$dom->loadHTML('<?xml encoding="UTF-8">' . $html);
Related
I import a csv to SQL server in SSIS. Here's what my settings look like:
The system firstly suggests 6501 and then in preview all letters look properly. However, when I proceed, it throws an error saying that it cannot proceed as it's really a 1252.
I change to 1252 and it all works now. However, I suddenly loose my regional letters. Here's what it looks like
Here's what I've tried:
Changing to 1250, 65001 etc
Ticking Unicode
changing Locale to Polish, polish(Poland), English
googling
searching stack
I'd appreciate if someone could point me toward a direction as nothing comes to my mind.
We are (still) using ZF1, to write/read from a Microsoft SQL database.
As long as a table field is of type NVARCHAR, everything is fine, special characters (like, chinese, polish, etc.) and emojis are saved correctly, 1:1 equal to the entered text in an html form.
But when it comes to column type TEXT, there are Question marks instead of the special characters/emojis in these columns.
Funny enough that everything is fine on servers where we got PHP5.6 running, with FreeTDS and php-mssql installed on them. This problem occurs on a system where PHP7.4 is installed, using only SQLSRV as the db driver.
According to this thread, a simple N should be enough...as long as the fields are set as NVARCHAR fields. We are using the update and insert methods of Zend Framework, so we got no clue how to save all these characters into TEXT columns.
When connecting, our bootstrap file is using UTF-8 as the character set, used as an driver option.
Is there any workaround we could try to accomplish this? We cannot change the column type because there are reasons why some colums are TEXT.
Why are you using text? It (text) has been deprecated for 16 years. text, however, does not support unicode characters, that would be ntext; but that too has been deprecated for 16 years.
To store up to 2GB of characters, that need to be unicode, use nvarchar(MAX). For a column that already exists, ALTER it.
ALTER TABLE dbo.YourTable ALTER COLUMN YourColumn nvarchar(MAX);
As per OP response in the comments the database setup can be put aside given that the TEXT column type behaves as expected when using PHP 5.6 and the operation fails on the same database when using PHP 7.4.
This allows to narrow the issue to runtime PHP charset handling. Not knowing all the specifics between the upgrade of PHP 5.6 to 7.4, the issue may lie in:
Different default charset in php.ini
Different behavior in the mssql driver with charset handling
Different operating system default locale which may affect the script
Different php file encoding (the encoding of the .php file itself may alter the charset used at runtime)
Since the issue at hand cannot be unambiguously identified based on the provided information, I may only suggest to check and eliminate the different possibilities one by one.
try detecting the actual encoding of the input text using any of the mb_* functions (maybe refer to this question)
try adding a comment in your script file containing special characters and be sure to save the file as UTF8 (or desired encoding)
try setting explicitly the driver charset (refer to this question) (or maybe in the connection string, if supported)
try setting the default php locale using setlocale and other functions of the sort
Those steps may guide you through a resolution but without guarantees.
I have a problem in my Wordpress. if i save a user nickname with any language other than English, like Persian, it will store it as empty value in DB
And then the URLs won't work anymore. Is this a problem of mine or it's something global and it should be the way it is?!
if there is a solution for it, i will be thankful.
Maybe installing Wordpress in Farsi and having a language plugin of some sort will fix your issue as of stated in the official documentation.
https://codex.wordpress.org/Right-to-Left_Language_Support#Writing_a_Post_in_RTL_Language
This is also probably due to the tables not being set to support the language special encoding.
Joomla media manager does not allow you to upload files with spaces in the filename providing the error message 'File name must only contain alphanumeric characters and no spaces'. Does anybody know if there is an option in Joomla or a way I can allow the upload of files with spaces in the name through the media manager?
I'm doing research on this right now. So far most sources I've seen seem to indicate that there is no such option. Even to the point of it being an issue posted on the bug tracker, to which the explanation given is that apparently file-names can't contain UTF-8 names which seems a little far fetch, but I don't know.
http://joomlacode.org/gf/project/joomla/tracker/%3Faction%3DTrackerItemBrowse&tracker_id%3D32/?action=TrackerItemEdit&tracker_item_id=33161&start=8350
There is mention of a duplicate to which I would love to find, but it was not linked to this question so I don't know which duplicate is referred to.
I am using wicket, spring and mysql. When I try to insert cyrilic characters to the database instead of the characters I see question marks ('?????').
When I use the i18n files I don't have such kind of problem. Also, when inserting characters from other place (i.e. mysql workbench) there is no problem. In other words, the problem is not in the database. The database and my html documents are in utf-8.
Could you please help me solve this problem.
Cheers!
Nikolay
Wicket has two more encoding-related settings, try this (in you Application initialization):
getMarkupSettings().setDefaultMarkupEncoding("utf-8");
getRequestCycleSettings().setResponseRequestEncoding("utf-8")