Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: mod_rewrite,ajax and country language

  1. #1
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default mod_rewrite,ajax and country language

    I'd like to make some changes into mod_rewrite and ajax

    - in polish language there are a lot of specific letters - and when people submitting their page polish marks are imported via ajax as a symbols - is thi spossible to correct it an dpolish marks will be imported as charset=iso-8859-2 ? (or may be it is imported only as UTF so I will put the information about it).

    Second problem with polish charset is inside mod_rewrite - i.e. when I see deatils: http://www.zgred.pl/informacje/7/-la...elone-naw.html

    you can see %f3 which should be a polish letter. but that polish letter should be changed to letter "o" - normally it is ó.

    we have teh following leeters:

    ą -> after mod_rewrite should be a
    ó -> o
    ę -> e
    ć -> c
    ź,ż -> z

    and so on ... can you help me to put changes into php code to make mod_rewrite correct for polish charset ?

  2. #2
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    sorry for bumping:

    need to include something like this (from Invision Power Board)

    //Polish Characters


    $text = str_replace( "ó", "o", $text);
    $text = str_replace( "Ó", "O", $text);

    or the code:

    $text = str_replace("\xF3","o",$text);

  3. #3
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    For mod-rewrite, you can change /lib/misc.lib.php
    Code:
      function SEOReplace($string) {
        $seo_replacement_str_arr = array (
          ' ',
          '-',
          '/',
          '\\',
          ',',
          '.',
          '#',
          ':',
          ';',
          '\'',
          '"',
          '[',
          ']',
          '{',
          '}',
          ')',
          '(',
          '|',
          '`',
          '~',
          '!',
          '@',
          '%',
          '$',
          '^',
          '&',
          '*',
          '=',
          '?',
          '+'
        );
        $string = str_replace($seo_replacement_str_arr, '-', $string);
    	
        $string = str_replace('a', 'a', $string);
        $string = str_replace('ó', 'o', $string);
        $string = str_replace('e', 'e', $string);
        $string = str_replace('c', 'c', $string);
        $string = str_replace('z', 'z', $string);
        $string = str_replace('z', 'z', $string);
    	
        $string = preg_replace(array('/-+/', '/-$/'), array('-', '') , $string);
        $string = urlencode(strtolower($string));
        return $string;
      }
    www.nicecoder.com
    www.dodyrw.com

  4. #4
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    It is working !

  5. #5
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    but still don;t know where or how to read polish charsets via AJAX ? WHen fetching META TAGS all polish charsets are overwritten by one stupid mark - and all data's must be reedited manually inside boxes.

  6. #6
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    To make ajax work with your language, you need to add charset in ajax.php at the header section.

    Code:
     header ("Content-Type: text/html; charset=ISO-8859-2");
      header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header ("Cache-Control: no-cache, must-revalidate");
      header ("Pragma: no-cache");
    Make sure to use correct charset.
    www.nicecoder.com
    www.dodyrw.com

  7. #7
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    Okey added.

    Unfortunately - when pressign button FETCH META TAGS it is always "pressed" and script doesn;t work.

    EDIT:
    sorry - it is working
    Last edited by linksor.com; 08-17-2006 at 09:34 AM.

  8. #8
    pimpmaster is offline Registered User
    Join Date
    Feb 2007
    Posts
    51

    Default

    I having the same problem and couldn´t get it to work following the steps in this thread.

    I have managed to activate mod-rewrite. I´m using Sweidsh chars in my category names, like "Hälsa och skönhet". But when I access that page (which is no problem) the address-field shows "h%c3%a4lsa-och-sk%c3%b6nhet".

    As I said, I added the lines in /lib/misc.lib.php but it still doesn´t work.

    Please help...

  9. #9
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    may be you sould use sth liek this:

    $string = str_replace('ä', 'a', $string);

    or

    $string = str_replace('%c3', 'a', $string);

  10. #10
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    If you still have this problem. You may submit a helpdesk ticket. We'll try to solve the problem.
    www.nicecoder.com
    www.dodyrw.com

  11. #11
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    remember:

    if you want to use national characters you should add in admin_tpl/header.html you national coding.

    After TITLE section in that file add i.e.:

    <meta http-equiv="content-type" content="text/html; charset=utf-8">

  12. #12
    Largo is offline Registered User
    Join Date
    Jan 2007
    Posts
    1

    Default

    Hello,

    Thanks Linksor! :-) You help me very much, but I want to provide next fix:

    If You want to have a correct encoding in CP, please do that:

    themes/$theme/cp/header.html

    Find:

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    Change to:

    <meta http-equiv="Content-Type" content="text/html; charset=your_charset">

    I think, are next version of INDEXU should have a global variable to change it in ACP, and all work perectly.

    Cheers,
    Largo
    Last edited by Largo; 08-02-2007 at 07:58 AM. Reason: Suggestion

  13. #13
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    I added western characters support.
    You can check the latest svn
    http://nicecoder.com/svn/index.php?act=changeset&id=513

    next, i'll make a global charset (for ajax & template) in application.php and will make utf-8 as default charset.

  14. #14
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    About utf-8, if the website previously using other charset (iso-8859-1), then it will not display properly when you change the charset to utf-8. This is because the character is encoded with iso-8859-1 earlier and utf-8 will recognize it differently.

    So unless it's a new website (no content), it's better to keep using the previously used charset.

    Update for global charset:
    http://nicecoder.com/svn/index.php?act=changeset&id=515
    Last edited by dody; 08-26-2007 at 11:43 PM.

  15. #15
    Bruceper is offline Active Member
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Should there not be a command for mysql to convert the data from one charset to another?

Page 1 of 2 12 LastLast

Similar Threads

  1. Language Translations
    By academy in forum Customers Lounge
    Replies: 0
    Last Post: 10-12-2005, 08:32 AM
  2. Replies: 2
    Last Post: 11-16-2004, 02:59 AM
  3. Replies: 0
    Last Post: 09-13-2004, 02:06 PM
  4. mod_rewrite and regular expressions
    By tjoerg in forum v5.x
    Replies: 4
    Last Post: 08-06-2003, 09:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •