New installation script stops me because of UTF issues, but my db IS in UTF

New installation script stops me because of UTF issues, but my db IS in UTF

Dallas Ray Smetter發表於
Number of replies: 22
On a brand new installation using latest code (as of last night), I am stopped on the db screen where it tells me:


Unicode is required to be installed /enabled...

It is required that you store all your data in Unicode format (UTF-8). New installations must be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).

CHECK

But my db is " MySQL charset: UTF-8 Unicode (utf8)"

This "check" won't let me proceed with the installation.
評比平均分數: -
In reply to Dallas Ray Smetter

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Hi, did you ever find a solution to this? I've got the same problem with a new install. I tried 1.8.2 and 1.9 beta
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Manish Verma發表於
Hi,

In config.php file in 1.7+, I have the following line:

$CFG->unicodedb = true;

I have not tried it in 1.8 or 1.9.

I think there is another way as well which is to edit the concerned database table to make moodle "think" that you have utf8 enabled.

Hope this helps,

Manish.
In reply to Manish Verma

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

MV and whoever else is interested,

You are correct about the line in config.php and the database (it's in the table mdl_config, assuming you are using the default table prefix). But as you might guess, it should only be used if you're sure your database is 100% unicode (every table and every column in every table), as I commented in the thread referenced by SH earlier in this thread. See also http://moodle.org/mod/forum/discuss.php?d=69967#p334071.

RLE

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

chhivhorng ly發表於
Dear Richard,
I want to ask you one about file size to upload.
Now I moodle 1.7.1+,
I get maximum file to upload just only 2MB.
Do you can help me?

best regards,
chhivhorng
In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Richard, the line in the config.php file does not work with 1.9beta. I still get the same message and can't get any further.

If I try a fresh install with a new database it won't let me install. However in phpMyAdmin I have created an empty unicode database as shown, called vle2.
附件 Picture_2.png
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

LM,

Your attached picture shows the (default) collation of marlinpr_vle2 as utf8_unicode_ci, but what about the character set? That needs to be utf8 also.

RLE

PS As both my post to which you replied and MK's post to which mine inked say, the line in config.php only tries to trick Moodle into believing the database is Unicode. The results can be disastrous if it isn't. Furthermore, MK's post points out that the flag set in that line was recognized in Moodle 1.6, not in 1.7, but again in 1.8. Your experience seems to show that it is ignored again by 1.9! Maybe there's something about odd numbers...

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Richard, I have no idea. I'm not really familiar with MySQL. My cPanel has phpMyAdmin but I can't see anything, so how do I check and change it if necessary?
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

LM,

OK. I have the XAMPPlite version of Moodle on my PC, so I don't have cPanel. I did download phpMyAdmin but I never installed it because I don't need to. Whatever I need to do with my database I can do with the mysql command.

So I looked for phpMyAdmin docs, both on my PC and the WWW. All I found was info on how to install, and a FAQ that deals with what if things go wrong. No user guide. Every doc refers you to a printed book that I don't have and don't plan to buy. But I got the impression that it lets you run SQL commands. So here are some SQL commands that MySQL recognizes that you can use.

To find out your database's character set, use (don't type comments in square brackets):
use marlinpr_vle2; [to make sure this database is the current one]
show character set;

To change it:

alter database marlinpr_vle2 character set utf8; [database name can be omitted it it is the current one]

HTH

RLE

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Richard, thanks for trying to help.

I couldn't find a command but I'm assuming (perhaps wrongly) that a query is the same thing so I've run alter database as shown below, but I still can't install. I was going to try and set up a new database with MySQL commands rather than the wizard so I could specify the character set and collation, but for some reason I don't have permission for that in phpMyAdmin. Any other suggestions?
附件 Picture_1.png
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

LM,

  1. Looks like phpMyAdmin accepted your ALTER DATABASE command (or statement or whatever you want to call it) as a query and executed it. So your database should be OK. The problem must be elsewhere (in Moodle, PHP, Apache, etc.)
  2. I am assuming you are telling Moodle when you try to install it to use vle2 and not mdle1! To be thorough I have to ask.
  3. You haven't said much about your environment. Are you using Apache? What version? What version of PHP? Of MySQL? What operating system/version?
  4. You may have noticed SH's post earlier in this discussion. It refers to an earlier discussion which refers to an article on problems with Unicode characters in web pages that can be solved with some Apache and/or php.ini settings. I don't know what that has to do with databases but if I were in your shoes, I might try them anyway. Because other than that, I don't know what else to do.

RLE

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Hi Richard.

Yes definitely using vle2 not mdle1, which was installed by fantastico (not using but haven't got round to deleting!)

I am using a hostmontser web server which has the following:

Apache version 1.3.37 (Unix)
PHP version 5.1.6
MySQL version 5.0.27-standard-log
Architecture x86_64
Operating system Linux.

My own operating system is Mac and the localhost MAMP version works just fine!

I could be wrong, but I don't think it is a problem at my end since I was able to install a slightly older version of 1.9b a few weeks ago on the same server with no problems. That is the system using the vle1 database.

Anyway I've added a comment to MDL-11743 in the tracker, but for now I'm stuck.

Can I
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Antonio Carlos Pereira Gomes發表於
Hi everybody,
I had the same problem, and others member too. There is a bug tracker at
http://tracker.moodle.org/browse/MDL-11743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_36386
Report you problem there (add comments and VOTE to the tracker), that moodle team take it under care.
But report and VOTE!
If not, it may not be relevant and won't have the attention needed to fix it.
Regards.
Antonio Carlos.
In reply to Antonio Carlos Pereira Gomes

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Leah M發表於
I'm experiencing the same issue on a fresh install, I've reported and voted on the tracker.
In reply to Leah M

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

LM (Leah) & LM (Lynn),

You both might benefit from my latest reply to BN (http://moodle.org/mod/forum/discuss.php?d=82414#p365142). You (Lynn) are welcome to try the same query I gave her, and post the results. The more the merrier! smile

As for you (Leah), I gave them the query I did because they are using MySQL. You haven't said what type of database you are using, so that may or may not apply to you. If you are using a different type, fell free to post it and I will see what query, if any, is appropriate. One of the types (Oracle or MS SQL Server, I forget which) isn't tested at all because it is always assumed to be Unicode.

RLE

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Hi Richard, thanks for trying to help. Have done as you asked and the result was:
character_set_database latin1

so I'm totally confuse now. Any ideas on how I change it?

Lynn
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

Lynn M,

OK. Assuming the correct database (vle2) was the active one when you ran that query, that is the reason Moodle doesn't believe your database is Unicode. Problem is, we are getting conflicting information from phpMyAdmin: in your earlier post you showed a screenshot of phpMyAdmin executing the ALTER DATABASE query and reporting it had done so successfully, so the character set of the database should be utf8. On the other hand, the character_set_database variable says it is still latin1.

Maybe the problem is in the database prefix marlinpr. I don't know enough about phpMyAdmin to know whether I was wrong to include it in the ALTER DATABASE query I gave you. Maybe it should have been just _vle2. If so, since it reported a successful execution of that query, maybe what it did was create a new database called marlinprmarlinpr_vle2, and make its character set utf8. You might want to check your list of databases for that. If that's what happened, try the ALTER DATABASE query again with just _vle2 as the database name.

Otherwise, it looks like there is a bug in either phpMyAdmin or MySQL itself that is causing it to maintain inconsistent info on databases. (I'm assuming the database is still empty. If a latin1 table was added to it, that is probably the problem.) Either the database really is utf8, and the variable Moodle is using to check it is wrong, or it really is latin1, and it didn't really execute the ALTER DATABASE query correctly. If that is true, I don't know what workaround Moodle could do; maybe the developers do. So let's pin this down and report the results to the tracker.

In the meantime, the only suggestion I would have if there really is a bug in MySQL regarding changing character sets of databases, is to drop the database and recreate it. I know it can do that because I have a utf8 MySQL database on my computer.

RLE

In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

Lynn M,

OK. Now I have seen your latest comment at MDL-11743 (I've added one too). My response is: yes, you could install MySQL on your home computer and create a Unicode database. But uploading it is problematic. For one thing,

  1. You need to know what files the database consists of (I think there are three of them for each table, and I don't know how many others; it's different for other types of databases).
  2. You need to know where those files are.
  3. You need to know what folder to upload them to on the server.
  4. You need to have write access to that folder.

Even if you did all that, I'm not 100% sure it would work. MySQL might not recognize a database it didn't create, and it might need to have a record of it in its own database. So I don't recommend it.

Is there some way you can run the mysql utility (instead of phpMyAdmin) on your server (for example, with telnet or ssh, or a shell command feature in cPanel)? That's what I use on my XAMPPlite installation of Moodle 1.8.2 on my PC. I don't know if cPanel has a shell feature, but if it is anything like WebMin's, it won't work.

If none of that helps, I can think of only one alternative: find a web host that will let you create Unicode databases!

RLE

In reply to Richard Enison

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Lynn Daley發表於
Hi Richard,

sorry I wasn't very clear. I was thinking more about creating a database in MAMP which I know is unicode, exporting it as an SQL file and then importing it into an empty database on the server. I don't really know enough about it to know whether that would work. Alternatively, could I export the newly created moodle database from MAMP and upload that and then copy my config.php file.

I asked hostmonster about creating a unicode database with MySQL but got fobbed off with 'we do not support manual installation of moodle, use fantastico', so you could be right about moving, but I'd rather not go through the hassle if I can work round it.

I might just do some experiments!
In reply to Lynn Daley

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Richard Enison發表於

Lynn M,

You're right. I did misunderstand you.

I was going to suggest asking your host's tech support about creating a Unicode database, but you have saved me the trouble. They seem kind of hostile.

I also see I don't need to persuade you against using Fantastico. I guess you are already aware of the problems with it.

Anyway, it might be interesting to see what happens. Because my next suggestion would have been to run a create database query to make a Unicode database, and see what it does with that. It apparently sabatoged your alter database query; would it do the same with create? Undoubtedly the sql file you upload will begin (after the header) with a create database query. Will that be executed without modification? I can't wait to find out! smile

So far, it seems that they won't allow you to create a Unicode database with phpMyAdmin, but they will allow Fantistico to create one. I don't know whether this is normal for phpMyAdmin, or whether they have modified it or reconfigured it.

All the watchers and commenters at MDL-11743 will surely be interested in the result of your import.

RLE

In reply to Dallas Ray Smetter

Re: New installation script stops me because of UTF issues, but my db IS in UTF

Ricardo Quiroz發表於

For CPanel Users solution can't be much easier than it is.

Go to phpmyadmin select your database select Operations under the menu and change the character set (Under Collation) to utf8bin and voila!