MySQL Forums
Forum List  »  PHP

Re: Newby needs some help - collation/charset ?
Posted by: Marvin Miller
Date: December 18, 2013 01:02AM

Thanks guys - we're making progress!!!

It now looks like I've been combating two issues. One was the user writing posts out in Word for Windows, copying and pasting the reply into the forum with it then coughing up the blank MySQL error box (there was an error in the database...)
Earlier I mentioned doing a search on all PHP files for SET NAMES and mysql_set_charset and coming up with nothing. After your post it occurred to me that the site has an HTML wrapper. I checked that sucker and found this;

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

As soon as I changed that to utf-8 the Word for Windows poster was able to make a post containing all sorts of goofy characters which cased that issue - one down!!

I then tried to fire off the php file/sql query that has always resulted in the blank MySQL error dialog box and got the same :( So that appears to be a different issue.

To that end...answered in line;


Rick James Wrote:
-------------------------------------------------------
> > It used to work with an older PHP and an older
> MySQL version.
>
> Smells like php.ini and/or my.cnf changed.
>
> SHOW CREATE TABLE

This command, when run against the table that the SQL query fails on results in this;

'ibf_mods', 'CREATE TABLE `ibf_mods` (\n `ID` int(10) NOT NULL AUTO_INCREMENT,\n `title` varchar(255) DEFAULT NULL,\n `sub_title` text,\n `category` varchar(30) DEFAULT \'Minor Mod\',\n `compatible` varchar(30) DEFAULT \'ipb 1.3\',\n `author` varchar(255) DEFAULT NULL,\n `email` varchar(255) DEFAULT NULL,\n `version` varchar(10) DEFAULT NULL,\n `mod_token` varchar(32) DEFAULT NULL,\n `mod_dir` varchar(255) DEFAULT NULL,\n `install_date` varchar(10) DEFAULT NULL,\n `howto` varchar(255) DEFAULT NULL,\n `codechange` longtext,\n PRIMARY KEY (`ID`)\n) ENGINE=MyISAM AUTO_INCREMENT=57 DEFAULT CHARSET=utf8'

>
> > I can include a MySQL script that fails each time
>
> Please do. But, please boil it down to just the SQL (not all the PHP around it).

That's going to be tough as I'm not sure it may be enough but I won't post the contents of the insert unless you ask for them. Here's the query;

INSERT INTO ibf_mods (title,sub_title,category,compatible,version,author,email,mod_token,install_date,mod_dir,howto,codechange) VALUES ('Create BBCodes in ACP','Erzeuge deine eigenen BBCodes und Buttons im ACP und speichere sie in der Datenbank','Major Mod','Invision Power Board 1.3','2.2.11','Peter','Peter@ibforen.de','mod_bbcode','1387232773','bbcode','sources/mods/bbcode/mod_bbcode_howto.htm','[COMMENT]

The contents of the insert are several pages of PHP code and the last of the query is this;

[HISTORY_OLD_END] =>This is part of the contents
')


>
> > regular square box
>
> The size of one character? Or a <textarea>?

It's the normal MySQL error box that usually contains a SQL eror message.
It always says,

"There appears to be an error with the widgets.com database.
You can try to refresh the page by clicking here, if this does not fix the error, you can contact the board administrator by clicking here

Error Returned

and the box contains NOTHING. It's blank. In the past that error has always returned a MySQL error message that's useful. I've never seen it blank.

>
> > I did a search of *.php files for the entire
> site for the keywords SET NAMES and came up with
> nothing as well as mysql_set_charset
>
> Well, you need it. And it may be "too late". You
> probably have garbled ("double encoded") text in
> the table(s).
>
> > At that point it seems to stop.
>
> Does it stop at the first accented letter? If so,
> you probably had non-utf8 data being treated as if
> it were utf8, and the INSERT truncated the
> strings. Data loss.
>
> Lots more:
> http://mysql.rjweb.org/doc.php/charcoll
> Included in there is a discussion of how to use
> SELECT HEX to discover if the data is already
> garbled.

I'll look into the above shortly (as best I can :)

Options: ReplyQuote


Subject
Written By
Posted
Re: Newby needs some help - collation/charset ?
December 18, 2013 01:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.