Zenpage admin fails to handle danish chars

masv Member
I have for some time tried to find a configuration combination for Zenphoto+Zenpage to handle danish chars (æøåÆØÅ) correctly.

I have tried do set $conf['UTF-8'] = false; (zp-config.php) and also setting Charset (within gallery configuration) to 'Western-European (ISO)'
Here the zenphoto+zenpage admin interface is handling the danish chars correctly
But then image album links within 'print_album_menu' fails to print the menu link.

If I do the below fix, the album menu is correct..

zp-core/functions-basic.php:117

/**
* encodes a pre-sanitized string to be used in an HTML text-only field (value, alt, title, etc.)
*
* @param string $this_string
* @return string
*/
function html_encode($this_string, $striptags=true) {
if ($striptags) {$this_string = strip_tags($this_string);}
$this_string = htmlspecialchars_decode($this_string, ENT_QUOTES);
//return htmlspecialchars($this_string, ENT_QUOTES, "UTF-8");
return htmlspecialchars($this_string, ENT_QUOTES, "iso-8859-1");
}

If I however uses UTF-8, then I'm having problems with the zenpage admin interface, here the use of the above chars is failing in titles and titlelinks, (comparing to the album handling where the danish chars is handled correctly).
The same goes for the text translation of Zenphoto into danish that I have made, this only fails within the zenpage admin interface.

Hope that I have described the problem in a understandable way...

Is the a way of making zenphoto+zenpage able to handle this correctly, without the above fix in functions-basic.php?

Btw. my danish translation of zenpage is made with UTF-8 set in Poedit.

R:Martin

Comments

  • Have you tried setting your gallery configuration character set to UTF-8? Zenphoto is designed to operate in UTF-8 character sets. Also check the character set of you database.
  • masv Member
    Hi,

    Yes I have tried that, and the result is that the char encoding problem is only within the zenpage (not zenphoto) admin gui, here I mean all the admin guidance text, as what I have translated, and then in the title and titlelinks, articl and page content do not suffer any encoding problems. As goes for the remaining part of the zenphoto admin gui, this neither have any encoding problems with danish chars.

    So the problem is somehow only related to handling danish chars in the zenpage admin gui, and in zenpage title, titlelink editing.

    If I try to type danish chars, in either a article/page title/titlelinks they just disappear..

    R:Martin
  • acrylian Administrator, Developer
    I am sorry I can't reproduce the error, æøåÆØÅ do work fine as a page title in Zenpage for me, even as a titlelink it works here. Unless you check "edit titlelink" the titlelink should be seo cleared actually.

    I tried an page name "Martin's ønskeliste" from your site and that works, too. The titlelink becomes "Martins-oenskeliste" here.
  • masv Member
    Hi,

    Hummm.
    It's not a problem when viewing my page, it's only an issue within the zenpage admin gui...

    But of course your right about the titlelink, here they should disappear, but not in the title..

    And my danish chars in my publich webpage, has been entered by performing the 'hack' in my first post::

    $conf['UTF-8'] = false;

    Charset='Western-European (ISO)' (within gallery configuration)

    function html_encode($this_string, $striptags=true) {
    if ($striptags) {$this_string = strip_tags($this_string);}
    $this_string = htmlspecialchars_decode($this_string, ENT_QUOTES);
    //return htmlspecialchars($this_string, ENT_QUOTES, "UTF-8");
    return htmlspecialchars($this_string, ENT_QUOTES, "iso-8859-1");
    }

    I was just looking for a way, to come around this..

    R:Martin
  • acrylian Administrator, Developer
    I just tried your danish translation and everything works fine here with the latest svn version, too. I just use the default encoding utf-8. I am sorry I have no idea.
  • The "hack" you used will place these characters in the Database in Western-European (ISO) encoding. So, I guess you need to remain in that character set. Please try changing the line of code to read `return htmlspecialchars($this_string, ENT_QUOTES, getOption('charset');` and let us know if that works for you. If so we can make the change part of the next release.
  • masv Member
    Well my hack, worked when I keept my db in western-European ISO, but after I tried to change it all into UTF-8, then I got into the problems.

    Your suggestion do not work when I try to keep it all in UTF-8, it do however with my original setup...
    $conf['UTF-8'] = false;
    Charset='Western-European (ISO)'

    What is strange, it that the encoding problem is only within zenpage admin gui on page/article title and in the gui it self..

    If I uses danish chars in conection with image part of the gui there is no problems, so album/image text or for that matter content in pages/articles..

    I have dropped a couple of screen dumps, on my webpage:
    http://www.svendsen-net.dk/blandet/zenphoto/zenphoto-zenpage.jpg.php

    To better explain/show my issue.

    Anyway thanks for your help and attention, may be it's something in my server setup..
    I'l go back to my original setup and include your code change:

    return htmlspecialchars($this_string, ENT_QUOTES, getOption('charset'));

    Which is a universial fix to my change to the same function..

    R:Martin
  • There are probably some other places that need changing as well. I am testing them now and they should be in tonight's build.
Sign In or Register to comment.