Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Problem with strange characters and code in description of picture  (Read 8882 times)

0 Members and 1 Guest are viewing this topic.

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL

I have discovered something strange in my CPG 1.4.2. One of my pictures has a problem with the description. It is shown as "In Friesland heb ik een mooi oranje truitje gekregen, mooi h讼/span>" instead of "In Friesland heb ik een mooi oranje truitje gekregen, mooi hè.".
The picture with the problem is Anne0280.JPG, here is the link to the album where it is in.

If I log in as admin and try to edit the picture I see the following as description:
Code: [Select]
In Friesland heb ik een mooi oranje truitje gekregen, mooi h讼/textarea>
                </td>
        </tr>        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        Zoekbegrip
        </td>
        <td width="100%" class="tableb" valign="top">
                <input type="text" style="width: 100%" name="keywords188" maxlength="255" value="" class="textinput" />
                </td>
        </tr>
        <input type="hidden" name="user1188" value="" />
        <input type="hidden" name="user2188" value="" />
        <input type="hidden" name="user3188" value="" />
        <input type="hidden" name="user4188" value="" />
        <tr>
                <td class="tableb" colspan="3" align="center">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td width="20%" align="center"><input type="radio" name="galleryicon" id="galleryicon188" value="188" disabled="disabled" class="checkbox" />Maak deze mijn ikoon</td>
                            <td width="20%" align="center"><input type="checkbox" name="delete188" id="delete188" value="1" class="checkbox" /><label for="delete188" class="clickable_option">Verwijder bestand</label></td>
                            <td width="20%" align="center"><input type="checkbox" name="reset_vcount188" id="reset_vcount188" value="1" class="checkbox" /><label for="reset_vcount188" class="clickable_option">Reset bekeken teller</label></td>
                            <td width="20%" align="center"><input type="checkbox" name="reset_votes188" id="reset_votes188" value="1" class="checkbox" /><label for="reset_votes188" class="clickable_option">Reset stemmen</label></td>
                            <td width="20%" align="center"><input type="checkbox" name="del_comments188" id="del_comments188" value="1" class="checkbox" /><label for="del_comments188" class="clickable_option">verwijder commentaar</label></td>
                        </tr>
                    </table>
                </td>
        </tr>
        <input type="hidden" name="pid[]" value="186" />
        <tr>
                <td class="tableh2" colspan="3">
                        <b>Klein_Anne0282.JPG</b>
                </td>
        </tr>
        <tr>
                <td class="tableb" style="white-space: nowrap;">
                        Bestands info
                </td>
                <td class="tableb">
                        600×800 - 80KB - 5 bekeken - 0 stemmen
                </td>
                   <td class="tableb" align="center" rowspan="5">
                        <a href="displayimage.php?&pos=-186" target="_blank"><img src="albums/upload/2005/jan_feb/thumb_Klein_Anne0282.JPG" class="image" border="0" alt="" /><br /></a>
            </td>
        </tr>
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        Album
        </td>
        <td class="tableb" valign="top">
                <select name="aid186" class="listbox">
              <option value="5">2004 < Anne is thuis!! - November / December 2004</option>
              <option value="3">2004 < Erasmus MC Sophia Kinderziekenhuis - Rotterdam</option>
              <option value="1">2004 < Juliana Kinderziekenhuis - Den Haag</option>
              <option value="4">2004 < Ruwaard van Putten Ziekenhuis - Spijkenisse</option>
              <option value="6" selected>2005 < Januari / Februari 2005</option>
              <option value="9">2005 < Juli / Augustus 2005</option>
              <option value="7">2005 < Maart / April 2005</option>
              <option value="8">2005 < Mei / Juni 2005</option>
              <option value="13">2005 < Mijn 1e verjaardag</option>
              <option value="15">2005 < November / December 2005</option>
              <option value="12">2005 < September / Oktober 2005</option>
              <option value="10">2005 < Vakantie Ameland</option>
              <option value="14">2005 < Vakantie Moezel (D)</option>
              <option value="25">2006 < Januari / Februari 2006</option>
              <option value="11">Diversen < Filmpjes</option>
                        </select>
                </td>
        </tr>
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        Titel
        </td>
        <td width="100%" class="tableb" valign="top">
                <input type="text" style="width: 100%" name="title186" maxlength="255" value="Anne0282.JPG" class="textinput" />
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top" style="white-space: nowrap;">
                        Omschrijving <a href="javascript:;" onclick="coppermine_help_window=window.open('docs/showdoc.php?css=water_drop&f=index.html&base=64&h=czoxNzoiYmJjb2RlIGhlbHAmbmJzcDsiOw%3D%3D&t=czoxODU6IkRlIHZvbGdlbmRlIGNvZGVzIGt1bm5lbiB2YW4gcGFzIGtvbWVuOiA8bGk%2BW2JdPGI%2BQm9sZDwvYj5bL2JdPC9saT4gPGxpPltpXTxpPkl0YWxpYzwvaT5bL2ldPC9saT4gPGxpPlt1cmw9aHR0cDovL0pvdXdzaXRlLm5sL11VcmwgVGV4dFsvdXJsXTwvbGk%2BIDxsaT5bZW1haWxddXNlckBkb21haW4ubmxbL2VtYWlsXTwvbGk%2BIjs%3D','coppermine_help','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=470,height=245'); coppermine_help_window.focus()" style="cursor:help"><img src="images/help.gif" width="13" height="11" border="0" alt="" title="" /></a>
                </td>
                <td class="tableb" valign="top">
                        <textarea name="caption186" rows="5" cols="40" class="textinput" style="width: 100%;" onkeydown="textCounter(this, 512);" onkeyup="textCounter(this, 512);">Ik slaap en mama heeft me even op de bank gezet.

If I look at this code it seems that there are pieces of CPG PHP code in it (editpics.php). It looks like the code for picture 282, which is not in the edit-list.

If I try to correct this strange error by deleting the code and put in the text it should be, I get the following error:
"Critical Error - Script called without the required parameter(s). (keywords188)"

But if I look directly into the MySQL database (table pictures) with phpmyadmin I see the correct description as I typed after adding this picture. There are no strange characters or code in it.

Who can tell me what's going wrong here and what I can do about it?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with strange characters and code in description of picture
« Reply #1 on: January 04, 2006, 06:31:32 am »

as a first step, upgrade to cpg1.4.3
Logged

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL
Re: Problem with strange characters and code in description of picture
« Reply #2 on: January 05, 2006, 12:13:59 am »

as a first step, upgrade to cpg1.4.3
I have installed CPG 1.4.3 on my test-PC and imported the complete database with phpmyadmin and have run update.php.
Now I have my actual gallery in CPG 1.4.3.
But this is not the solution to my problem, I still see all these strange things :(

I looked at it a bit more closely, so I can describe my problem in a different way:
If I go to editpics.php to edit my album I get a list of all the pictures in it, this works fine. But in the description text-box of picture 280 I see the strange text and code I described earlier. In the list picture 282 is completely missing. The generated HTML-code is strangely put in the description text-box of the predecessing picture 280.

I don't understand it. It seems that the PHP-script fails somehow, but why does it work fine and without any problems for all my other albums?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with strange characters and code in description of picture
« Reply #3 on: January 05, 2006, 04:32:39 am »

remove html markup from description fields, it's not meant to be there. Use bbcode instead.
Logged

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL
Re: Problem with strange characters and code in description of picture
« Reply #4 on: January 05, 2006, 05:25:35 pm »

remove html markup from description fields, it's not meant to be there. Use bbcode instead.
I don't use html markup in the description fields.
Originally I added a description to the picture 280 which ended with the characters "hè."

The html markup appears in the description field if I try to edit an album (editpics.php). It's the html code for the edit-boxes of the missing picture 282.
If I try to delete the unwanted html code, I get the error "Critical Error - Script called without the required parameter(s). (keywords188)"
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with strange characters and code in description of picture
« Reply #5 on: January 05, 2006, 05:26:49 pm »

make sure the file isn't corrupt - re-upload it.
Logged

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL
Re: Problem with strange characters and code in description of picture
« Reply #6 on: January 05, 2006, 10:31:03 pm »

make sure the file isn't corrupt - re-upload it.

I copied the file editpics.php out of the zip-packed file and re-uploaded it to my gallery dir.
But this has unfortionally no effect  :(
I really don't get it, if I check the database with phpmyadmin I see no strange code at all, just the descriptions as I typed them by adding the pictures  ???
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem with strange characters and code in description of picture
« Reply #7 on: January 06, 2006, 12:44:56 am »

In FireFox, I see "In Friesland heb ik een mooi oranje truitje gekregen, mooi h讼." and it's the same in the source.

In IE, I see "In Friesland heb ik een mooi oranje truitje gekregen, mooi hè." in the source, but
"In Friesland heb ik een mooi oranje truitje gekregen, mooi h[]." in the browser window.
Note that I use [] to signify a square box.

So IE receives the text correctly but then doesn't display the accented e (which is probably my browser setting since I don't often use accented letters).  I don't know why FireFox shows the source incorrectly.  It must convert the character internally - maybe that's my setup as well.

I don't see anywhere "In Friesland heb ik een mooi oranje truitje gekregen, mooi h讼/span>" as you see.  Have you looked at the source of the web page output?  I'm not sure what could eat up the opening < of the span tag and not the rest of the tag (like a comment tag would).

I don't have anything to suggest since I'm not knowledgable about language encoding.  It seems that the accented e is being converted into something that eats up the opening < of the span tag so it's no longer an HTML tag.  phpMyAdmin may convert the character to something more portable.  Have you checked the source of its web output?
Logged

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL
Re: Problem with strange characters and code in description of picture
« Reply #8 on: January 06, 2006, 10:37:36 am »

So IE receives the text correctly but then doesn't display the accented e (which is probably my browser setting since I don't often use accented letters).  I don't know why FireFox shows the source incorrectly.  It must convert the character internally - maybe that's my setup as well.

I don't see anywhere "In Friesland heb ik een mooi oranje truitje gekregen, mooi h讼/span>" as you see.  Have you looked at the source of the web page output?  I'm not sure what could eat up the opening < of the span tag and not the rest of the tag (like a comment tag would).
I see "h讼/span>" if I try to edit my album (editpics.php) or the picture (editonepic.php). If I look normal I the album I see the same as you, the square box.

Quote
I don't have anything to suggest since I'm not knowledgable about language encoding.  It seems that the accented e is being converted into something that eats up the opening < of the span tag so it's no longer an HTML tag.  phpMyAdmin may convert the character to something more portable.  Have you checked the source of its web output?
I also think is the "è" character that's causing this problem somehow, because the problem is over when I change (in phpmyadmin) the "è" into a normal "e" character.
I still don't understand it, because it's not the only place in my CPG where I use such characters, but there I have no problems with them.
Logged

Lara

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Problem with strange characters and code in description of picture
« Reply #9 on: January 11, 2006, 02:41:54 pm »

Coppermine seems to have a problem with special characters with the new version 1.4.2/1.4.3. I discovered the same problem you have. I don't think there is a solution other than avoiding special characters. But that's not a "real" solution because cpg should support special characters if it supports utf-8.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with strange characters and code in description of picture
« Reply #10 on: January 11, 2006, 09:27:20 pm »

Lara, don't be part of the problem, be part of the answer. Saying "coppermine should support..." is just wishful thinking, let's see your code contribution instead. Just nagging isn't helpful. The dev team would like to create a flawless app, it's just not that easy to accomplish.
Logged

Lara

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Problem with strange characters and code in description of picture
« Reply #11 on: January 19, 2006, 01:34:39 pm »

If I was able to code a solution I would have done it - but I have only very little knowledge about php, so I can't code anything complex by mself. But anyway this seems to be a general problem since I am not the only one with this problem and I am looking for a solution but so far nobody posted a solution - only asking to code it by myself. But I am not able to do it so I rely on support from anybody else. Saying that I should code it by myself doesn't help me at all.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Problem with strange characters and code in description of picture
« Reply #12 on: January 19, 2006, 06:27:43 pm »

OK, I already posted this in various threads about language and Umlaut issues, but I'll summarize it for you once more.

The dev team recommends using utf-8 both for encoding and database. This is fine if you do a fresh install. If you upgrade an install where you have text content in non utf-8 encoding, you'll run into the issues described on this thread when doing as recommended and using utf-8 encoding. As a solution, you'll have to convert your existing textual content from the old encoding you used to have (e.g. western iso-8859-1) to utf-8. The other option when doing an upgrade is to leave the encoding just like you had it before, but then of course you won't benefit from the advantages utf-8 offers.
What you're actually doing is using spare parts of a Porsche sports car to repair a Hummer four-wheel-drive vehicle or vice versa. Both cars are fine when used for the purpose they have been built for and when using the proper spare parts, but if you mix them, you'll run into problems.

What do you expect us to do to solve this issue? If you're doing a fresh install of cpg1.4.x, everything should work as expected when using the recommended utf-8 (with the drawback that EXIF/IPTC isn't fully compatible with UTF-8) from the start or when using your "traditional" encoding (like Western iso-8859-1). Running a mixture will cause issues.
When doing an upgrade you should stay with the encoding you used before or convert everything.

Joachim
Logged

whmeeske

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 68
    • WHMEESKE.NL
Re: Problem with strange characters and code in description of picture
« Reply #13 on: January 19, 2006, 10:34:53 pm »

The dev team recommends using utf-8 both for encoding and database. This is fine if you do a fresh install. If you upgrade an install where you have text content in non utf-8 encoding, you'll run into the issues described on this thread when doing as recommended and using utf-8 encoding...
...If you're doing a fresh install of cpg1.4.x, everything should work as expected when using the recommended utf-8 (with the drawback that EXIF/IPTC isn't fully compatible with UTF-8) from the start or when using your "traditional" encoding (like Western iso-8859-1). Running a mixture will cause issues.
When doing an upgrade you should stay with the encoding you used before or convert everything.
I discovered this problem after a fresh install of CPG 1.4.2.
After your advice I did a fresh install of CPG 1.4.3. And after that I still had the same problem.

I'm going to change problem-characters with normal ones with phpmyadmin directly in the database. After that I have no problems at all.
Thanks for the help anyway, I think this topic can be closed now.
Logged

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Problem with strange characters and code in description of picture
« Reply #14 on: January 20, 2006, 01:15:15 am »

As I have said before I also have this problem - with an existing AND a fresh install. EXIF/IPTC doesn't seem to support utf-8, so I don't understand why we have to use it as standard - it simply doesn't work well enough - for me there are just disadvantages using utf-8. Before making utf-8 as standard I would have appreciated to solve the iptc/exif encoding issue. Since all keywords, titles etc. are extracted from IPTC I can't use the search function at all for all words containing special characters and the displaying of such IPTC data looks strange as well. Anyway I am shortly before of smashing coppermine since it causes such important problems and I am fed up with those problems and no solution in sight.
Logged

Blado

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Problem with strange characters and code in description of picture
« Reply #15 on: September 10, 2006, 09:52:51 am »

I'm going to change problem-characters with normal ones with phpmyadmin directly in the database. After that I have no problems at all.
Thanks for the help anyway, I think this topic can be closed now.

Hi, I have the same problem too.
I updated my version of Coppermine moths ago and I didn'y find a solution.
I use italian language but I noticed if I use English_gb there's no problems but I prefer to use italian.
How can I solve it?
I can't understand from previous posts: must I rewrite all album's names, all comments... or there's a faster solution?
Thanks!
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 20 queries.