1 xeroxer Jun 11, 2006 18:51
3 xeroxer Jun 11, 2006 19:46
Well the </body> I'm not writing. That just shows up in the error.
Might be something else but i still down't know what...
I updated the forum as the readme said.
- = EDIT = -
I now tested writing in my blog just in plain English and it worked like a charm. Then I tried writing the same thing but adding a "ö" at the end and then the error was there again...
4 yabba Jun 12, 2006 12:18
Do you have a link to your blog?
¥
5 xeroxer Jun 12, 2006 14:56
6 edb Jun 12, 2006 15:41
I thought of something that *might* be valuable for you. Sometimes a problem shows up that exists only because a file somewhere (somehow) is corrupted in some way. You never can track it down is the thing. Fortunately there is a solution - IF this is the root cause.
Save your conf/_config.php file and your media folder and your skin if you've customized it at all. Grab a brand new copy of the zip for your version and unzip it on your local PC. Edit the new conf/_config.php to have the connection info and baseurl and admin_email from your old one. Also set config_is_done to 1. Delete EVERYTHING from your server, then upload all the new files. See how you're doing with the 'custom' skin, then go ahead and upload your media folder and your skin (if you customized it).
It's a shotgun approach, but sometimes it works. If it doesn't you've ruled out "it's a broken file" eh?
7 xeroxer Jun 12, 2006 16:58
EdB wrote:
I thought of something that *might* be valuable for you. Sometimes a problem shows up that exists only because a file somewhere (somehow) is corrupted in some way. You never can track it down is the thing. Fortunately there is a solution - IF this is the root cause.
Save your conf/_config.php file and your media folder and your skin if you've customized it at all. Grab a brand new copy of the zip for your version and unzip it on your local PC. Edit the new conf/_config.php to have the connection info and baseurl and admin_email from your old one. Also set config_is_done to 1. Delete EVERYTHING from your server, then upload all the new files. See how you're doing with the 'custom' skin, then go ahead and upload your media folder and your skin (if you customized it).
It's a shotgun approach, but sometimes it works. If it doesn't you've ruled out "it's a broken file" eh?
I did as you suggested.
I downloaded the file again.
Deleted all my files from the webhost.
Set the config settings.
Uploaded it all but stille the same error.
Darn...
8 xeroxer Jun 14, 2006 08:55
Can I ask this. Can anyone else here use their blog to enter letters like åäö? If you have updated and can then I know the problem is just local for me. So I will downgrape myself to the old version that worked...
9 yabba Jun 14, 2006 11:07
I have no problem posting it on the 9.2 demo blog, or on my 1.6 blog, or on a 1.8cvs blog.
The bit that's causing you the problem is the check() function b2evocore/_class_htmlchecker.php (approx line 105)
function check($xhtml)
{
// Convert encoding:
if( empty($this->xml_parser_encoding) || $this->encoding != $this->xml_parser_encoding )
{ // we need to convert encoding:
if( function_exists( 'mb_convert_encoding' ) )
{ // we can convert encoding to UTF-8
$this->encoding = 'UTF-8';
// Convert XHTML:
$xhtml = mb_convert_encoding( $xhtml, 'UTF-8' );
}
}
// Open comments or '<![CDATA[' are dangerous
$xhtml = str_replace('<!', '', $xhtml);
// Convert isolated & chars
$xhtml = preg_replace( '#(\s)&(\s)#', '\\1&\\2', $xhtml );
$xhtml_head = '<?xml version="1.0"';
if( ! empty($this->encoding) )
{
$xhtml_head .= ' encoding="'.$this->encoding.'"';
}
$xhtml_head .= '?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$xhtml = $xhtml_head.'<body>'.$xhtml.'</body>';
if( !xml_parse($this->parser, $xhtml) )
{
$xml_error_code = xml_get_error_code( $this->parser );
$xml_error_string = xml_error_string( $xml_error_code );
switch( $xml_error_code )
{
case XML_ERROR_TAG_MISMATCH:
$xml_error_string .= ': <code>'.$this->stack[count($this->stack)-1].'</code>';
break;
}
$pos = xml_get_current_byte_index($this->parser);
$xml_error_string .= ' near <code>'.htmlspecialchars( substr( $xhtml, $this->last_checked_pos, $pos-$this->last_checked_pos+20 ) ).'</code>';
$this->html_error( T_('Parser error: ').$xml_error_string );
}
}
Unfortunately I have no idea why it errors out.
You can either disable the html checker in conf/_config.php (please read the warnings in the appropriate section of the file), or you could neuter the function for admins :-
function check($xhtml)
{
Global $current_User;
if ( isset( $current_User ) and $current_User->Group->ID == 1 ) return; // is an admin user
// not an admin user
¥
10 kiwi Jun 14, 2006 15:20
I have exactly the same problem..!
I, too, am writing in Swedish - and it really is our letters å, ä and ö that's causing these error messages. But why is a totally different matter... :roll:
This must be taken care of a.s.a.p.
I will follow this thread closely.
/ Kiwi
11 xeroxer Jun 15, 2006 09:14
kiwi wrote:
I have exactly the same problem..!
I, too, am writing in Swedish - and it really is our letters å, ä and ö that's causing these error messages. But why is a totally different matter... :roll:
This must be taken care of a.s.a.p.
I will follow this thread closely.
/ Kiwi
So I am not the only one.
That feels like a relief.
Maybe it will be a higher priority when more people have the same problem.
This thread is wuite inactive.
Maybe because people don't have a solution.
Because it's a bug. :-(
12 yabba Jun 15, 2006 10:15
Lets see if we can narrow the problem down a tad more then, comment out this section of code in the function I posted above and see if you still get the error.
/* lets disable this bit for now
// Convert encoding:
if( empty($this->xml_parser_encoding) || $this->encoding != $this->xml_parser_encoding )
{ // we need to convert encoding:
if( function_exists( 'mb_convert_encoding' ) )
{ // we can convert encoding to UTF-8
$this->encoding = 'UTF-8';
// Convert XHTML:
$xhtml = mb_convert_encoding( $xhtml, 'UTF-8' );
}
}
end of disabled bit */
¥
*moved to bugs forum*
13 kiwi Jun 15, 2006 11:52
Thanks for helping us! :D
But sorry, it didn't work out... :(
I commented out the lines you specified, uploaded the file and then tried to use "åäö". Same result; "invalid character near...".
Very strange indeed. If I write a new entry that says "Hello all" it works perfectly. But if I write "Hello äll", the error appears.
And oh, the same error appears if I try "åäö" just in the subject. Don't know if that info helps you, but just thought I should tell you that.
Edit: Same error appears when you try to use "åäö" in comments.
/ Kiwi
14 yabba Jun 15, 2006 11:59
Hmmm, ok, first off, put the code back to how it was, then just to check that it really is that funtion, change the code to this :-
function check($xhtml)
{
return;
See if it allows you to post (and then restore the code back to it's orginal state).
¥
15 kiwi Jun 15, 2006 12:12
OK... restored the code and then wiped out everything under the "function check($xhtml)", replacing it with a "return;"...
And it worked! B)
No problem using "åäö" in the subject line or in the text itself. Very nice. :D
I don't have that much experience with php, but... this seems like an ad hoc-solution. ;) Can I just go on using my blog as I want to, or should I/we wait for a more reliable solution?
/ Kiwi
16 yabba Jun 15, 2006 12:17
Ok, that tells us that it is definately this function that's the bad boy.
Unfortunately I have to go wander round a field for a tad, so for now restore the code to it's original state.
¥
17 bogge Jun 16, 2006 10:10
Im a total beginner at PHP, so this is probably totaly wrong but it works for now.
In the _class_htmlchecker.php and function Check (row 133) i added "$xhtml = utf8_decode($xhtml);".
$xhtml = $xhtml_head.'<body>'.$xhtml.'</body>';
$xhtml = utf8_decode($xhtml);
if( !xml_parse($this->parser, $xhtml) )
18 yabba Jun 16, 2006 12:37
Cool, hopefully that'll work for the people with the problem :D
¥
19 kiwi Jun 16, 2006 15:22
Wow! That small line did the trick! :p
Thank you so very much! All of you! B)
/ Kiwi
20 blueyed Jun 17, 2006 03:30
XeroXer, kiwi and bogge:
can you provide a link to some phpinfo file (maybe as a private message)?
Because I cannot reproduce it and would like to know what's going wrong here.
So, a page with a simple "phpinfo();" statement would help and additionally it would be great, if you could add
pre_dump( $encoding, 'encoding');
pre_dump( $this->encoding, 'this->encoding' );
pre_dump( $this->xml_parser_encoding, 'xml_parser_encoding' );
pre_dump( function_exists('mb_convert_encoding'), 'mce?' );
at the end of function SafeHtmlChecker() (around line 82).
Then post a new entry and a box should appear that holds the values of the expressions to pre_dump().
Please post them here.
Which browser are you using?
I suppose you are using "Svenska (SE)" as your user's locale?
In which charset gets the page delivered (Ctrl-I for header infos on most browsers)?
I could imagine, that the page gets sent as UTF-8, though the locale's charset is latin1 (ISO-8859-1).
Sorry for the inconvenience, hopefully we can track this down.
21 xeroxer Jun 17, 2006 11:13
Sorry for no response for a while.
I PM'ed you a phpinfo(); file.
This is the result I get when posting with the extra lines:
encoding:
string(0) ""
this->encoding:
string(0) ""
xml_parser_encoding:
string(0) ""
mce?:
bool(false)
encoding:
string(0) ""
this->encoding:
string(0) ""
xml_parser_encoding:
string(0) ""
mce?:
bool(false)
I have been using:
Firefox, Mozilla, Internet explorer - Same problem with all...
ISO-8859-1
22 blueyed Jun 17, 2006 15:39
XeroXer, does the above fix from bogge work for you?
23 xeroxer Jun 17, 2006 16:45
blueyed wrote:
XeroXer, does the above fix from bogge work for you?
Yes it works for me...
24 blueyed Jun 17, 2006 22:16
Can you please try then adding
$this->encoding = 'UTF-8';
above
// Open comments or '<![CDATA[' are dangerous
$xhtml = str_replace('<!', '', $xhtml);
// Convert isolated & chars
$xhtml = preg_replace( '#(\s)&(\s)#', '\\1&\\2', $xhtml );
in _class_htmlchecker.php around line 119.
Please also remove/comment out the fix from bogge, of course.
More questions:
Does it also fail, if you use another locale (en-EU for example) for your user and the default?
Is it reproducable at http://demo.b2evolution.net/ ? (choose "stable" in the version variants drop down on the left)
25 bogge Jun 18, 2006 00:00
Adding that line dont work for me :(
I have tried to change locale from and to EU and SE, at user and "system". But with no luck.
I can not reproduce this error on the stable or development demo.
26 blueyed Jun 18, 2006 02:39
bogge, does the pre_dump-block above produce the same results as with XeroXer?
I've looked at the phpinfo() supplied by XeroXer and have seen that he has libxml2 Version 2.6.16, while the demo server has libxml2 Version 2.6.23 (while it's using the same PHP version).
Given that $xhtml = utf8_decode($xhtml); fixes it, it seems to be utf8 encoded.
But on the other hand, if the page is delivered as latin1/iso-8859-1 the browser will send the input in the same charset by default. Additionally, giving "charset=UTF8" to the XML parser (what my above line is supposed to do) does not help.
Strange..
27 xeroxer Jun 18, 2006 08:56
I tried your fix blueyed and it didn't work for me either.
Same as for bogge.
Are you done with my phpinfo(); file so I can remove it?
28 bogge Jun 18, 2006 11:07
Adding the pre_dump results in the same as XeroXer.
I use Firefox, Svenska (SE) as user locale and page is ISO-8859-1.
Webserver use libxml2 version 2.6.16.
blueyed, don´t the check function convet to UTF-8 (row 107)?
Thats why i added the utf-8 decode!? :D
29 blueyed Jun 18, 2006 16:34
blueyed, don´t the check function convet to UTF-8 (row 107)?
Thats why i added the utf-8 decode!?
No.. because the function mb_convert_encoding() does not exist for both of you (according to the pre_dump block).
That's why it's so strange.
@XeroXer: yes, you can remove it. Thanks!
30 xeroxer Jun 18, 2006 18:37
In _class_htmlchecker.php from row 108 to 118 this is what it says:
// Convert encoding:
if( empty($this->xml_parser_encoding) || $this->encoding != $this->xml_parser_encoding )
{ // we need to convert encoding:
if( function_exists( 'mb_convert_encoding' ) )
{ // we can convert encoding to UTF-8
$this->encoding = 'UTF-8';
// Convert XHTML:
$xhtml = mb_convert_encoding( $xhtml, 'UTF-8' );
}
}
Is that what youré talking about?
31 yabba Jun 18, 2006 19:58
Just for a laugh, could you change that to :-
// Convert encoding:
if( empty($this->xml_parser_encoding) || $this->encoding != $this->xml_parser_encoding )
{ // we need to convert encoding:
if( function_exists( 'mb_convert_encoding' ) )
{ // we can convert encoding to UTF-8
$this->encoding = 'UTF-8';
// Convert XHTML:
$xhtml = mb_convert_encoding( $xhtml, 'UTF-8' );
pre_dump( 'hello world', 'wtf?');
}
}
¥
*edit*
Blueyed : how come the vars get dumped twice?
XeroXer wrote:
Sorry for no response for a while.
I PM'ed you a phpinfo(); file.
This is the result I get when posting with the extra lines:
encoding: string(0) "" this->encoding: string(0) "" xml_parser_encoding: string(0) "" mce?: bool(false) encoding: string(0) "" this->encoding: string(0) "" xml_parser_encoding: string(0) "" mce?: bool(false)
I have been using:
Firefox, Mozilla, Internet explorer - Same problem with all...ISO-8859-1
32 blueyed Jun 18, 2006 22:39
yep. Notice the "if( function_exists( 'mb_convert_encoding' ) )" there.
In a 0.9.2 installation I use for testing I was just able to post this without issue:
When I went to edit the post I saw where it had stripped out the </body> tag, but that sort of makes sense given that post content typically is not the end of the generated page.
Is it possible that something else is at work here?