1 of 2
1
Wiki Module Behaviour
Posted: 20 June 2008 02:21 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

The original message is deleted because I used too many characters; sorry

The problem, that looked like a bug, had to do with how the Forum and the Wiki (that only have one field for Title and Category, etc) deal with non-standard letters from, say, the European and Scandinavian alphabet. This issue only effected the Title and Category names in the Forum but, because users can create Titles and Category names from within Wiki entries, effects the whole of the Wiki.

And the simple answer is that the underlying mySQL database must have both TABLES and COLUMNS (that by default are set to latin1_swedish_ci) set to utf8_general_ci (though some believe the columns are best set to utf_bin; although I have not tried this).

Any attempt to use direct obfuscation in Wiki entries, for example;

é or é

appears be re-written to ascii by the Wiki engine, to;

é - without the leading zero or double-zero

Any attempt to use direct obfuscation in Wiki titles or categories, for example;

[[é]] or [[Category:é]]

apears to be completely ignored.

Simply keying these characters from the keyboard works fine, however at the current time I cannot make them display correctly in all places unless the EE {charset} tag is also set to UTF-8 [however this may simply because more work is needed].

If your database is set to the default and needs both tables and columns changing the PHP code in the entry at the end of this thread DOES NOT WORK. Try this instead;

<?php
// Fill in your configuration below
$db_server      = 'localhost';
$db_user      = '';
$db_password   = '';
$db_name      = '';

// Do not change anything below this
// set_time_limit(0);
header('Content-type: text/plain');

$connection = mysql_connect($db_server, $db_user, $db_password) or die( mysql_error() );
$db = mysql_select_db($db_name) or die( mysql_error() );

$sql = 'SHOW TABLES';
if ( !(
$result = mysql_query($sql)) )
{
   
print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n";
}

// Loop through all tables in this database
while ( $row = mysql_fetch_row($result) )
{
   $table
= mysql_real_escape_string($row[0]);
   
$sql2 = "ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
   
   if ( !(
$result2 = mysql_query($sql2)) )
   
{
      
print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n";
      
      break;
   
}
   
   
print "$table changed to UTF-8 successfully.<br>\n";

   
// Now loop through all the fields within this table
   
$sql3 = "SHOW COLUMNS FROM $table";
   if ( !(
$result3 = mysql_query($sql3)) )
   
{
      
print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n";
      
      break;
   
}

   
while ( $row3 = mysql_fetch_row($result3) )
   
{
      $field_name
= $row3[0];
      
$field_type = $row3[1];
      
      
// Change text based fields
      
$skipped_field_types = array('char', 'text', 'blob', 'enum', 'set');
      
      foreach (
$skipped_field_types as $type )
      
{
         
if ( strpos($field_type, $type) !== false )
         
{
            $sql4
= "ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_bin";
            if ( !(
$result4 = mysql_query($sql4)) )
            
{
               
print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n";
               
               break
3;
            
}
            
print "---- $field_name changed to UTF-8 successfully.<br>\n";
         
}
      }
   }
   
print "<hr>\n";
}

mysql_close
($connection);
?>

I have attached a script that does work but please, please do not run this script on a production database without first testing it completely or having your host technical support validate or run it for you.

NB Any foreign characters keyed into any part of EE whilst the EE general configuration -> charset = latin-1 appear to be corrupted if general configuration -> charset is later changed to utf-8 (or visa-versa); the best way to address this if you need to make the changes is to use admin -> utilities -> find and replace to change them back again.

NNB the Wiki pMCode does however contain a bug an irritating feature that changes composite non-seo-friendly urls in Wiki entries, that can only be overcome by obfuscation. Any links to applications, like Open-Realty, that use both ampersands and square-brackers in urls need all three characters obfuscated or else the Wiki engine will corrupt them. For example;

http://www.open-realty.com/index.php?action=searchresults&pclass;[]=1


GRRRRR, even with code tags I cannot stop EE from adding the semi-colon - believe me when I enter the above URL there’s no semi-colon in it; I call this a bug!

will be re-written to (note the semi-colon after pclass);

http://www.open-realty.com/index.php?action=searchresults&pclass;[]=1


In addition the Wiki engine uses pMCode so having square-brackets is a no-no anyway. to make this link work first obfuscate the ampersand to overcome the bug, then obfuscate the square-brackets ot overcome the pMCode parser.

http://www.open-realty.com/index.php?action=searchresults&#38;pclass[]=1

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 20 June 2008 02:29 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Do you have a link to the wiki? I would like to take a look—and we can always remove this entry fromt he db directly if we have to.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 20 June 2008 03:20 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

Thanks Ingmar,

You can find the Title page here;

http://www.immocherche.com/i/wiki/Special:Titles

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 20 June 2008 10:15 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

As this was moved from Bugs by the moderator I assume it’s not un-normal.

Can anyone (a moderator, maybe?) confirm that all I need to do is hand-delete the entry from the database and that this will not de-stabilise my software?

With thanks.

jiF

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 20 June 2008 01:56 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004
Jules In France - 20 June 2008 10:15 AM

As this was moved from Bugs by the moderator I assume it’s not un-normal.

Well, I am not calling it a bug just yet.

Can anyone (a moderator, maybe?) confirm that all I need to do is hand-delete the entry from the database and that this will not de-stabilise my software?

The wiki is really rather simple. So, yes you should only have to delete the offending article from exp_wiki_page. I just tested that, and it worked fine.

Be sure to make a backup first, as always, just in case.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 20 June 2008 02:46 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

THIS IS NOT THE ORIGINAL POST WHICH WAS DELETED BY ELLISLAB STAFFERS - SEE [#8] FOR CONTENT

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 21 June 2008 03:31 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004
Ingmar Greil - 20 June 2008 01:56 PM

So, yes you should only have to delete the offending article from exp_wiki_page. I just tested that, and it worked fine. Be sure to make a backup first, as always, just in case.

Sounds a bit like Sam Goldwyn (“Yes, but keep copies.”—When his secretary asked him if she should destroy files that were over ten years old.)!

Would it not be safer to risk editing the entry title directly in the database and then using the application to delete the entry?

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 21 June 2008 04:13 AM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004
Jules In France - 20 June 2008 02:46 PM

INGMAR; IT WAS VERY RUDE TO DELETE MY POST THEN POST YOUR REPLY INTO MY ENTRY FRAME. SHAME ON YOU.

Ouch. My sincerest apologies; I did not delete your post, I must have clicked the wrong button (“Edit” instead of “Quote”). That was entirely unintened, of course. I tried to restore your posting as good as possible, feel free to make any amends.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 21 June 2008 04:16 AM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

im sure its not a bug - i prefer to call it an undocumented and unsupported feature.

Well, the fact is that I have been unable to reproduce it. I created a few test articles with nonsensical titles with umlauts and accents, and it all went well.

... but the truth is there’s nothing to stop a european or scandinavian user adding a local character to a title and killing their pages, which is simply incomprehensible to me.

I really would like to get to the bottom of this one, but it worked perfect for me, not killing any page at all. So, I don’t exactly know where the corruption stems from, in your case (although we know how to fix it).

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 21 June 2008 04:19 AM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004
Jules In France - 21 June 2008 03:31 AM

Sounds a bit like Sam Goldwyn (“Yes, but keep copies.”—When his secretary asked him if she should destroy files that were over ten years old.)!

We are not talking about 10 year old files, though, we are talking about your database. I mean, you don’t have to make a backup, and all will probably go well, but if it doesn’t… well, easy enough to roll back. So, it’s a sensible thing to do.

Would it not be safer to risk editing the entry title directly in the database and then using the application to delete the entry?

That is probably another option, but not knowing precisely what went wrong, I cannot guarantee it to work, and I can’t test it locally—which I did with the “delete” method. You can try that first, though.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 21 June 2008 05:03 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004
Ingmar Greil - 21 June 2008 04:19 AM

We are not talking about 10 year old files, though, we are talking about your database. I mean, you don’t have to make a backup, and all will probably go well, but if it doesn’t… well, easy enough to roll back. So, it’s a sensible thing to do.

Forget “10 years” - the point is that only fools rely upon irrelevant copies; I could equally argue that it is an insane thing to do; in a database of 185 tables (I have other application tables access by EE through the Query[sic] Module - it demands that all tables be in the same database) and over 150mb of data there’s no way I’m coming back after three months of client activity to resolve disruption caused by a flippant forum comment when Elisslabs officially does not even believe to be an error, and restoring this iteration of the database (tomorrow maybe, three weeks from now; never)!

All we know is that on my application on my server EEWiki changed & eacute; to & eacute because it is hard-coded to do so and that in environments different to yours this creates instability that renders either the application or the environment un-usable.

Because when faced with EE’s hard-coded response to high-ascii characters in title, chapter and namspace fields (you know what I mean because I’ve PM’d chapter (if not verse)  on this subject) I still cannot get a simple engineering response that says;

ExpressionEngine is coded to do the following…..., because ExpressionEngine operates by doinf the following…..

so that at least we understand and can work with the nature of the beast (ie learn to live with it).

If we can talk engineering issues then this thread has value; let’s put an end to anecdotal observation and banter.

With deference to all for the tone.

Jules

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 21 June 2008 10:04 AM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

Greetings, Jules,

I need to ask you to take a step back here and take a deep breath.  In regards to the editing of your post - that was an error that Ingmar has already apologized for. 

In regards to backups - we always recommend that you make regular backups, as well as special backups right before a direct database manipulation.  This is simply good practice because who knows what could go wrong? The power could go out in the middle of the submission, for all we know, causing unexpected behavior.  If you don’t want to do a backup, then it is at your own risk and the risk of your data and website - if something does go wrong, without a backup, no-one can help you.

Now, software is not a black and white beast.  Yes, it behaves by rules we set, but it is very complicated.  If we can not reproduce this error then it is going to be hard to promise you that it is fixed. So - can you reproduce this error again? If so, please post the *exact* step by step guide so that we can try on our own installations and see if we can figure out what happened.

If you work with us on this, we can try to get to the bottom of it, but we will need your polite cooperation to do so.

Thanks.

 Signature 
Profile
MSG
 
 
Posted: 21 June 2008 11:45 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

Lisa, a pleasure to hear your voice as always.

Our EE code sits on a medium-sized dedicated server with over 20gb of data and all databases and content are backed-up nightly to a second drive, weekly offsite and immediately prior to any service and support; I therefore thank you all for your concern but this was not my point.

I have an issue that is demonstrable in our server environment and I can reproduce the error on a lab-based MAMP server.

The issue impacts both WIKI and FORUM modules on iso-8859-1 pages.

Please feel free to review the following pages;

http://www.francepropertyshowcase.com/en/forums to see the impact of using the following in Forum/Category names;

&#238; - &#244; - &#233; - etc

However in FORUM entries these entities work fine.

The WIKI behaves differently. Whatever code is injected into the Forum Category names is injected into the WIKI entires, presumably because users can create entry titles and category names from directly within Wiki entries.

As a simple example of this in practice please visit the following URL;

http://www.immocherche.com/i/wiki/Special:Categories

You will see that for the 9th item (the last sub-category of Aquitaine) the rendering of the sub-category name is correct.

If however you select that sub-category it is renamed on the next page to;

category:aquitaine -> pyrã©nã©es-atlantiques

Rather like the Forum/Category names this is unacceptable.

To take this further is impossible here so I have created a little Wiki page for you here; http://www.immocherche.com/i/wiki/pyrenees/

Hopefully this does justice to my initial and un-refuted point that both the FORUM and WIKI have undocumented and unsupported functionality that renders them unsuitable outside of anglo environments.

However as I started out by saying, this code sits on a dedicated server so if you feel that server configuration issues need addressing we’ll do anything (because we’re really dedicated to a solution) to help achieve a solution.

On the other hand if you say is “Yep, you’re right. Tough” then that’s cool too because we’ll stop wasting our time on things we cannot change, etc…

One day we will find wisdom…..!

With thanks,

Jules

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 21 June 2008 12:25 PM   [ Ignore ]   [ # 13 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

Hi, Jules - we’ll work through this but I still need more details to clear up my confusion.  You said this:

Whatever code is injected into the Forum
Category names is injected into the WIKI entires,

Do you mean using the new extension?  Or how are you doing this? That is where I’m getting lost right now.  Does this happen if you create wiki and forum entries independently?

And again, the example pages are very helpful, but can you do a list format of the steps to take to reproduce?

1. Create an entry in the wiki using the title “blah”
2. View page

That sort of thing?

Thanks!

 Signature 
Profile
MSG
 
 
Posted: 21 June 2008 01:29 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004

To what extent is the behaviour of these application driven by the “collation” of the mySQL database; mine is running latin1_swedish_ci and it occurs to me that this might not be optimal. I can for example see that the Codeignitor Wiki operates differently raising the probability of mySQLServer configuration as a factor.

My EngineHosting account for example runs utf8_general_ci

Would you be able to comment on the efficacy of the following script to change the collation and test this proposition;

Changing the collation for all tables in a mysql database can be time consuming depending on how many tables you have.

That’s why we recommend using the following PHP script for changing the collation for all tables at a time:

WARNING THIS CODE DOES NOT WORK - SEE THE FIRST ENTRY IN THE THREAD FOR NEW CODE

<?php
$db
= mysql_connect('localhost','myuser_mydbuser','mypassword');
if(!
$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('myuser_mydbname'); $result=mysql_query('show tables');
while(
$tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query
("ALTER TABLE $value COLLATE utf8-general_ci");
}}
echo "The collation of your database has been successfully changed!";
?>

Make sure to substitute in the above script:

- myuser_mydbname with your database name;

- myuser_mydbuser with your mysql username;

- mypassword with your password for the mysql user;

- utf8-general_ci with your new collation if different;


////////////////////////////////////////////////////////

Lisa,

Please confirm that when you followed the forum link you can see malformed forum category names?

Please confirm that when you followed the wiki:category links and then the category I pointed out and you were able to see the malformed title?

Please confirm that when you read the wiki entry I created for you that you can see that different types of obfuscation behave differently as entry body text, as title [[text]], and as [[category:text]] and that can see how the wiki makes merry mayhem of anything other than the most rudimentary links?

I do not see what else is confusing (ignore “injection”; my physician has a whole other meaning for that so lets not get hung up on terminology) and as the forum and wiki are on different site I’m not sure how independent these two examples (of the same bug?) can be.

What you see is what I get; I just need to know if what you see on my sites is normal?

J

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 22 June 2008 08:22 AM   [ Ignore ]   [ # 15 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23522
Joined  05-20-2002

Jules- the thread is long and I’m having trouble following it, so shall leave it to Lisa and Ingmar.  But before I confer with them on it- did you mean to strike thru the content in the last post?  As in- Lisa had gotten back to you via pm and cleared it up, or you’d figured it out, so it was now moot.  Or is it just a typo and awaiting response?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 22 June 2008 10:11 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  369
Joined  12-31-2004
Robin Sowell - 22 June 2008 08:22 AM

Jules- the thread is long and I’m having trouble following it, so shall leave it to Lisa and Ingmar.  But before I confer with them on it- did you mean to strike thru the content in the last post?  As in- Lisa had gotten back to you via pm and cleared it up, or you’d figured it out, so it was now moot.  Or is it just a typo and awaiting response?

Hello Robin,

For me the EEWiki is broken (something to do with pMCode maybe, but either way I cannot live with the consequence).

I was horrified to find that the same feature resonates in the EForum as well (we’re testing that for tolerance tomorrow).

Either way both applications may be following our dedicated-server support team off the project by the end of the month as a consequence of yesterday’s song-and-dance.

I was deeply saddened that despite building up a great team Ellislabs seems to have lost the support-plot here. I see no evidence that anything other than the core code, all that legacy pMachine stuff and the mini-modules et-al, are even semi-evangelised by one or a small group of staffers. This makes getting traction on Gallery, Querie and Wiki (beyond “it’s complicated”) is mighty tough for those of us who bought into the whole tightly integrated software model.

Sad to say it was not always thus.

jiF

 Signature 

There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy - William Shakespeare

Profile
 
 
Posted: 22 June 2008 10:41 AM   [ Ignore ]   [ # 17 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

Jules, I don’t know what you mean here by “semi-evangalized” - we give equal attention to all of the code.  What you are seeing is not typical and something we can work through, but you’re going to have stop jumping to conclusions about this.

The DB collation should not be an issue.  Let’s work on the charset first.

Can you give me two pieces of information:

Open up /themes/wiki/your_theme.php and tell me what your charset line calls?

And, go here:

Admin > Control Panel Settings

and let me know what your charset is?

Thank you.

 Signature 
Profile
MSG
 
 
Posted: 22 June 2008 10:55 AM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  179
Joined  06-13-2007
Jules In France - 20 June 2008 02:21 AM

[...]
And the simple answer is that the underlying mySQL database must have both TABLES and COLUMNS (that by default are set to latin1_swedish_ci) set to utf8_general_ci (though some believe the columns are best set to utf_bin; although I have not tried this).
[...]

Hmm… pardon me, but I’m strongly objecting in this. You do not have to change default settings of your database to use nonlatin characters. I’ve got entire UTF-8 Cyrillic site (Russian), and my mySQL database set to latin1_swedish_ci. And no, I do not have any problems with forum and wiki. I read your posts here and I believe your problems are in your database configuration, not in EE.

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64909 Total Logged-in Users: 36
Total Topics: 81853 Total Anonymous Users: 26
Total Replies: 440064 Total Guests: 241
Total Posts: 521917    
Members ( View Memberlist )