Encoding gallery title, coverting zp-config.php from ANSI to UTF-8

Hi,
I would like to use some polish characters in `$conf['gallery_title']`,
but zp-config.php is ANSI default, so when I use łóąśćżźć in gallery title
my browser shows only (*&(*&% in the titlebar

I also use polish chars for album titles and they work fine,
either below the album thums or in the titlebar.

Do you think that converting zp-config.php from ANSI to UTF-8 could solve this problem?

Comments

  • trisweb Administrator
    I think that storing the configuration in the database would solve the problem...

    For now though, converting the zp-config.php to UTF-8 file might work... or if you have the php iconv or Multi-byte encoding libraries, you could do a conversion just on those strings. Either way, as long as you set the character set parameter to UTF-8 in zp-config.php it should work fine...
  • I have a similar problem. I want to use the swedish character ö in the title for my gallery and I get a questionmark instead. It's possible to use the swedish characters in albumnames but not in the galleryname.

    Btw, thanks for a great albumscript.
  • OK, so I saved zp-config.php with UTF-8 encoding.
    I added polish letter to the gallery title and I can see it on titlebar now :)
    For editing text files (php, html ...) I use notepad2
    http://www.flos-freeware.ch/notepad2.html which has a lot of useful features,
    like for example changing encoding from ANSI to UTF-8

    ZP is Godsend :D
  • Thanks for the tip. I tried to convert it to UTF-8 using Notepad++ but it didn't work. I used notepad2 and now it works.
  • trisweb Administrator
    Wow! It works! Excellent. I'd recommend that as a standard way to get UTF-8 characters into your gallery title/description.

    When I make the admin interface for options, I'll be sure to store strings as UTF-8 in the database.
  • piyda Member
    Well, tough luck for me I guess. It didn't work. I can't use letter "ć" (Croatian language) and is frustrating. If anybody can help, pleeeeeease!!!

    Instead of Šimunić Antun, it says Šimuni& #263; Antun. The site is complete and I want to bring it online, but I can't because of this minor glitch. Just to mention - zenphoto 1.0.5 worked just fine for me.

    Here's an example: http://www.umjetnici.com/index.php
  • trisweb Administrator
    "ć" should be like any other character. How (and where) are you entering it? It looks like you're entering the entity (&#xxxx) instead of the character. Zenphoto deals in straight unicode, so you should just enter the character "ć" straight without any special notation.
  • piyda Member
    Well, actually, I'm not. I'm just trying to put ć into "album name". I wrote (&#xxxx) here just to show you result of entering letter ć into "album title". And there is no difference if I'm putting (&#xxxx) or ć, there is a same outcome.

    As I said before, there is no problem with letter ć in "album description" or anywhere else on the site, just in "album title".

    I had no such problem in version 1.0.5. I just updated it to 1.0.8.2. Maybe if I downgrade again?
  • You could always try iso-8859-1 encoding too..
  • trisweb Administrator
    Well ontelo, I do think this is a zenphoto bug somewhere, I just can't figure out why it's happening...

    Basically what's happening is that the ampersand (&) in the entity output for the ć is being encoded itself! So the string is doubly-encoded, which simply reveals all the & symbols.

    Now, like I asked before, and I'll ask it clearer this time:

    How and where are you entering the album title? Is it through AJAX form? Was it only on the initial upload? Is it in the album edit screen? I need to know where to look.

    Also, as far as I know, Zenphoto _never_ converts characters to their entity forms, so is there any way that the form '&#263' could have been entered there? Are you using some kind of automatic entity plugin or something?

    Try updating the title through the AJAX edit (just click it on the album page). Also try in the admin edit screen if you haven't already. If that doesn't work, look at lines 237 and 240 of `template-functions.php` and delete the `htmlspecialchars(` and the closing `)` end paren. That should work for you now while I track down where that encoded entity is coming from...
  • piyda Member
    Thanks for the help, erasing htmlspecialchars helped. I also tried updating title through the Ajax, but it didn't work, the name was erased and the text "Click to add a title..." appeared. Is it possible that Ajax don't work in Firefox? I also tried updating title (through Ajax) in IE7 but it won't let me enter letters Š or ć.

    Now to try to help find the bug, here are some answers you requested:
    I'm entering the album title in administration. I go to: "Edit titles, descriptions, and other metadata" > click on the name of the album to edit it > write Antun Šimunić in "Album Title".
    I don't understand what you want to ask me with "Was it only on the initial upload". Actually I uploaded folder with images via FTP client and it name was "antun_simunic".
    To answer your second question, I never entered '&#263' there. I even never saw this entity form before and I don't even know what entity plugin means :-)
    Only thing I used was your CMS zenphoto and Firefox. That's all :-)

    And I have to say, you do excellent work with zenphoto. Keep up the good work!
  • piyda Member
    It's me again. Sorry to write a new post, but I just realized that the letter 'Ä‘' has the same problem. I discovered it on the page where you can see picture title (example http://www.umjetnici.com/index.php?album=balazin_stjepan&image=Andjeo_s_rasirenim_krilima.jpg).

    I removed 'htmlspecialchars()' on lines 438 & 441 of 'template-functions.php' and it fixed the problem.
  • trisweb Administrator
    All non-ascii characters would have the same problem if one did...

    I'm still not seeing this behavior on any of my installations... those entities should not be there! Very strange.

    Oh, would you please submit a new ticket for this at http://www.zenphoto.org/trac/newticket ? Thanks!
  • piyda Member
    Here is a text I tried submitting to http://www.zenphoto.org/trac/newticket and it gives me this result: Submission rejected as potential spam (Akismet says content is spam):

    In administration I'm trying to put ć into "album name" and it works, but on the frontend it spells 'ć' instead ć. There is no difference if I'm putting 'ć' or ć, there is a same outcome.

    Erasing 'htmlspecialchars()' on some lines in 'template-functions.php' helped. I also tried updating title through the Ajax, but it didn't work, the name was erased and the text "Click to add a title..." appeared. Is it possible that Ajax don't work in Firefox? I also tried updating title (through Ajax) in IE7 but it won't let me enter letters š or ć.

    I'm entering the album title in administration. I go to: "Edit titles, descriptions, and other metadata" > click on the name of the album to edit it > write Antun Šimunić in "Album Title".

    Would you be so kind and do it for me?
  • trisweb Administrator
    I've entered your bug as http://www.zenphoto.org/trac/ticket/61 and turned off Akismet -- it seems like it does not work well for Trac spam, perhaps it thinks blog comments that look like bug reports are spam (and they probably would be)! Sorry for the confusion.
Sign In or Register to comment.