1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

1.7 Database Collation

Discussion in 'General Troubleshooting' started by noreplay, Jul 1, 2016.

  1. noreplay

    noreplay New Member

    hi,
    After very long time, finally I download HOTARU-CMS today from this forum and install (for 2nd time) on local-host with Xampp.

    BASE URL : http://localhost/hotaru/
    FRIENDLY URLS : on
    Rename htaccess_default to .htaccess : yes
    change on .htaccess file Line (9) : RewriteBase /hotaru

    1- I submit link with English language, every things work fine. when I click on English-link, page redirect to Link page like this (http://localhost/hotaru/Sample-English-Link/)
    2- I submit link with Arabic language, every things work fine but when I click on Arabic-link, page redirect to
    Link page like this (http://localhost/hotaru/نموذج-العربية-لینک/) and I see this ERROR:

    Oops!
    Page not found
    نموذج-العربية-لینک

    -----
    I check database and I see Collation, then I change default Collation for database in (hotaru/install/index.php) on Line (695):
    ----
    from:
    define("DB_COLLATE", 'utf8_unicode_ci');
    to this:
    define("DB_COLLATE", 'utf8_general_ci');
    ----
    and install HOTARU-CMS again. but the character save on DataBase like this: (( %D9%85%D8%A3%D9%85%D9%88%D8%B1%D9%8A%D8%AA )) and previous Error still exist.


    can you help me?
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    Welcome to Hotaru and sorry to hear you're having this problem. It might be related to this vsprintf problem. Would you try the solution and see if it works?
     
  3. noreplay

    noreplay New Member

    I read your post but I don't understand so much. what is the fix part?
     
  4. valMETNG

    valMETNG Administrator Staff Member Admin

    My apologies - I thought I had included the fix. Please add the following code onto line 664 of \libs\extensions\ezSQL\ez_sql_core.php:
    Code:
    foreach ($args as $key => $arg) { $args[$key] = str_replace('%', '%%', $arg); }
     
  5. noreplay

    noreplay New Member

    every things convert to %somthings%somthings%...........%somthings !
    I add that fix on line 664,
    1st when I submit link (Submit a Story 2/3 ) Error show: Nothing submitted... and when I paste link again and press "next" nothing work. after submitting the link every things convert to this:

    http://imgur.com/FVrpWtR
     
  6. noreplay

    noreplay New Member

    do know another fix? what is wrong with Arabic characters in general?
     
  7. valMETNG

    valMETNG Administrator Staff Member Admin

    Well that's not good... :)

    Let's try something else. Put ez_sql_core.php back to the way it was (remove that line) and change line 277 in content/plugins/submit/libs/SubmitFunctions.php which is:
    Code:
    $h->db->query($h->db->prepare($sql, $key, serialize($h->vars['submitted_data']), $h->currentUser->id));
    ...to:
    Code:
    $h->db->query($h->db->prepare($sql, $key, json_encode($h->vars['submitted_data'], JSON_UNESCAPED_UNICODE), $h->currentUser->id));
    ...and change line 301 which is:
    Code:
    if ($submitted_data) { return unserialize($submitted_data); } else { return array(); } 
    ...to:
    Code:
    if ($submitted_data) { return get_object_vars(json_decode($submitted_data)); } else { return array(); }
    Now check to see if it solves the problem (you'll have to resubmit the link). If it doesn't, it might be the bookmarking SELECT is the issue and we'll try something else. Also, make sure your plugins are in the correct order (which can oftentimes cause problems).
     
  8. noreplay

    noreplay New Member

    after this change (lines 277 and 301 in content/plugins/submit/libs/SubmitFunctions.php) every things work like before and when I click on Arabic link title to view link page, I see this:

    Oops!
    Page not found
    نموذج-العربية-لینک

    I not test Plugin order Yet, but I will and post my answer. Do you know another solution?
    Another thing:
    I forgot to tell you, in this mode => (FRIENDLY URLS: NO), every things work good. why not work in (FRIENDLY URLS: YES)?

    I check Plugin order and sort them as the manual. the problem still exist!
     
    Last edited: Jul 1, 2016
  9. valMETNG

    valMETNG Administrator Staff Member Admin

    OK, something is odd in your environment because I just tested the post title نموذج-العربية-لینک in my base build and it worked fine (with friendly URLs on). Is there anything in your error log? I'm also wondering if it has something to do with Xampp. I've never been able to get Hotaru to work properly in Xampp (although that might have been a different problem).
     
  10. valMETNG

    valMETNG Administrator Staff Member Admin

    Can you also please retry without changing this too? I don't believe this should be necessary because it works in my base build without this change.
     
  11. noreplay

    noreplay New Member

    OK, I test Orginal HOTARU-CMS again and post my result here.
    I think you are right. this problem is very odd. believe me, I install several times and I want to continue to find the problem. maybe XAMPP configuration was wrong. do you have any recommendation about XAMPP configuration? like XAMPP Version or Apache httpd.conf or php.ini or something else?
     
  12. valMETNG

    valMETNG Administrator Staff Member Admin

    Sadly, I don't. XAMPP was always behaving differently than when I tested on my host in multiple ways and I was spending too much time troubleshooting the environment. So now I just do all my testing on my host and abandoned XAMPP.
     
  13. noreplay

    noreplay New Member

    maybe I test Hotaru-CMS on my host with real server. maybe solve my problem.
    usually I test scripts 1st on local-host, to create new responsive theme for them. before that I work with wordpress, joomla, prestashop, opencart, elgg, pligg, oxwall, boonex and for now hotaru.
    this is not my 1st problem, Other user told me by MSG: There is not any problem in hotaru with my language. I accept that.
    I tyr to install hotaru-cms on my host.
     
  14. noreplay

    noreplay New Member

    I install on real server and I have the same problem.
    I download Hotaru-cms from this link: is this version is stable? maybe I must download another version?
     
  15. valMETNG

    valMETNG Administrator Staff Member Admin

    Yes, that's the correct link. If you'll provide me the exact example (e.g., link, title, summary), I can test it in my build. But I tested the title on an editorial and it worked fine.
     
  16. noreplay

    noreplay New Member

    I thinks my server configuration have problem. what do you things about that?
    can I ask you something? do you submit this link in your hotaru cms and with screen-shot linked that picture on imgur.com (for example: after submitting link go to link page and create a screen-shot for me)
    thanks
     
  17. valMETNG

    valMETNG Administrator Staff Member Admin

    So this is interesting: I was able to submit the link as you'll see from the two screenshots (which show the templates bookmarking_list.php and bookmarking_post.php):
    screenshot 1.png screenshot 2.png
    However, when I click on the link from the post page, I get "Bad Request Your browser sent a request that this server could not understand.." When I copied your link from above which looks like this:
    screenshot 3.png
    ...the browser takes me to a valid website page. But when I paste the link into Hotaru to submit, the link becomes:
    screenshot 4.png
    After submission, when I click on it, the page looks like this:
    screenshot 5.png
    I don't know if this is a problem with Hotaru or because my laptop's copy/paste function is doing something to it.
     
  18. noreplay

    noreplay New Member

    this is exactly what I want to say. every things work good except this. I don't know why this is work in ( friendly URLs = off) !!
    me and my friends translate many script but we don't know how to manage this problem?

    I think link data must be saved on database like other script. in hotaru cms arabic text save on database like this: %D%A%D .....

    do you have any idea? do you know some users before me, who work with Hotaru-cms in Arabic or Persian language?
     
  19. noreplay

    noreplay New Member

    do you have any online website with Hutaro-cms? to I sign-up on your website and just test 1 Link.?
     
  20. valMETNG

    valMETNG Administrator Staff Member Admin

    Well that was an interesting problem to solve :)

    The problem is actually in the database structure. The column post_orig_url in the hotaru_posts table is of data type VARCHAR and limited to only 255 characters. However, in reality, there really isn't any limitation to the length of a URL. The URL you provided is 837 characters. However, when it is stored in the database, it's encoded which makes it 1367 characters. The URL is, thus, being truncated when stored in the database and, when retrieved, isn't decoded properly (because it's short characters).

    To fix this problem, you'll need to either change the length of the post_orig_url to a large number (2083 is the maximum length supported by IE which is the most restrictive browser, but you also need to leave room for urlencoding) - e.g.:
    Code:
    ALTER TABLE `hotaru_posts` CHANGE `post_orig_url` `post_orig_url` VARCHAR(3000); 
    ...or you can change the data type of post_orig_url to TEXT - e.g.:
    Code:
    ALTER TABLE `hotaru_posts` CHANGE `post_orig_url` `post_orig_url` TEXT; 
    @shibuya246, although this is the first time we've seen this problem, it probably makes sense to modify the next version (I'd suggest VARCHAR (3500) to be on the safe side).
     

Share This Page