1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Convert Amharic to English

Discussion in 'PHP' started by KangBroke, Dec 2, 2015.

  1. #1
    I have a client who has multiple websites and they use both English and Amharic. He already has issues with Google Adsense not showing on pages with mostly Amharic, the new issue is that you can properly store Amharic in the SQL db. However when I echo the row I get ??? ??? ???.

    I have already searched google to find some saying to change the ISO language codes, that didn't help. Also others say that this happens with Japanese.

    When I view the source code of the output, it shows in plain English. However the frontend shows ????


    Example Text stored in SQL db:

    የ5000 ሜትር የቤት ውስጥ ሪከርድ ባለቤቷ ጀግናዋ አትሌት ገንዘቤ ዲባባ ጋር የተደረገ የሰርፕራይዝ ጥሪ

    Output to frontend:

    ?5000 ??? ??? ??? ???? ???? ???? ???? ???? ??? ?? ????? ??????? ??
     
    Solved! View solution.
    Last edited: Dec 3, 2015
    KangBroke, Dec 2, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    What is the character encoding? Both on the page, and in the database? Such errors are usually because of wrong encoding somewhere.
     
    PoPSiCLe, Dec 3, 2015 IP
  3. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #3
    SQL for that is set to utf8_general_ci

    page is set to
    <html lang="en">
     
    KangBroke, Dec 3, 2015 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    That's not the page part you need to worry about -- what's the server sending as charset in the headers? Do you have a charset declaration in the HTML in case the server isn't sending ANY header?

    Remember, the default for server headers and browsers is ISO-8859-1.

    You may also have to make sure the accept-charset is set properly on any forms. You may also need to be sure you aren't using any goofy webfonts since many such things don't support a whole lot outside ASCII7, you MIGHT get Latin-1 if you are lucky.

    Basically there are a half dozen things you have to check the moment you tread outside that bottom 7 bits of ASCII.
     
    deathshadow, Dec 3, 2015 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #5
    Oh, if your output is coming from PHP, you can make sure the header is set correctly by sending this in your PHP:

    header('Content-Type: text/html; charset=utf-8');

    Before any output starts. Just thought I'd mention that -- it's an integral part of every PHP program I write now.
     
    deathshadow, Dec 3, 2015 IP
  6. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #6
    Thank you both, After I add ----> header('Content-Type: text/html; charset=utf-8');

    into my header and run the tool at web-sniffer .net it shows my HTTP Response Header as
    Content-Type: text/html; charset=utf-8

    It used to just read as
    Content-Type: text/html;

    If I run this thread through web-sniffer . net the only difference I see is that DP has this ---> Vary:Accept-Encoding

    and currently this project still shows question marks.
     
    KangBroke, Dec 3, 2015 IP
  7. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #7
    Set the charset for the SQL as well. It might be connecting with the wrong encoding.
     
    PoPSiCLe, Dec 3, 2015 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #8
    Again, also make sure the font you are using client-side actually supports the characters you are trying to use...

    If we could see a sample output page of where it's not working, that might help.
     
    deathshadow, Dec 3, 2015 IP
  9. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #9
    I'm embarrassed with the project personally. My professor wanted help, he is cheap and persistent on keeping horrible logos, and terrible designs overall. He had a script and wanted me to keep it as close to how it was as I could.
    http:// ethiopianthisweek. com / ethioonutube. com/
     
    KangBroke, Dec 3, 2015 IP
  10. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #10
    I'm seeing the Amharic characters here on those sites, not seeing any block characters (win 7 FF)... silly question, but what are you on for a computer? Quackintosh or Linsux fault maybe? Is the problem restricted to a specific browser?

    I know linsux default fonts can REALLY drop the ball on extended UTF characters at times, many of the "default" fonts like freesans just flat out don't support them.

    Winblows, OSuX, iAss, Linsux, gimboid -- they all suck just in different ways.

    Though... huh, those sites flat out refuse to load here in IE -- like... at all.

    Yeah, I'm not seeing any reason either of those sites would render the characters incorrectly, they seem to be working just fine here... so I'd be questioning the browser or OS, not the site! Maybe whatever you are on isn't using or doesn't have the "Nyala" system font that windows falls back on for all the font sets for unicode amharic?

    I had that problem recently on a linsux platform with the UTF-8 geometric shapes... Just one of the many reasons linux is pathetically crippled to me so far as using it as a desktop OS. (on top of it kerning text like a sweetly retarded rhesis monkey on crack, lacking proper user feedback during application launch, calling crippled hardware support "complete", etc, etc...)
     
    deathshadow, Dec 3, 2015 IP
    KangBroke likes this.
  11. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #11
    If you refresh the page the videos below in the white box reload randomly. You should see some with ??? after 1-2 refresh's of the page.

    I am using Windows 10, and it loads in FF,IE & Chrome for me.

    All three browsers after 1-2 refreshments I see ones with ??? and when I check them in the SQL they are in Amharic
     
    KangBroke, Dec 3, 2015 IP
  12. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #12
    Do you have a screencap of the area you are referring to as I'm not seeing on either site anything that even remotely resembles what you describe.

    -- edit -- not that I can make out much of anything with the illegible colour contrast, and useless font sizes leaving me diving for the zoom only to find out it's a crappy fixed width layout that breaks when zoomed.
     
    deathshadow, Dec 3, 2015 IP
  13. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #13
    I do not see anything on those sites that looks anything like that... went through a few links too, nada. I certainly don't see any YT embeds...

    -- edit -- ok, they're in the code, but those entire sections are not rendering here in FF, Chrome or Vivaldi. Like... at all. Was wondering why some of the links went to blank pages... figured the site was incomplete.

    Given the horde of errors every page hemorrhages in the console, I'd be shocked if that works on any browser. No wonder IE basically throws it's hands in the air and walks away from it.
     
    deathshadow, Dec 3, 2015 IP
  14. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #14
    [​IMG]
     
    KangBroke, Dec 3, 2015 IP
  15. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #15
    For me, I even see it on my android
     
    KangBroke, Dec 3, 2015 IP
  16. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #16
    Ok, that's strange, it flipped the post order here? Did you delete the original post and re-post the pic again?

    Either way, I'm not seeing those sections at all here... and given the underlying code, I'm surprised the pages even render.
     
    deathshadow, Dec 3, 2015 IP
  17. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #17
    Well he paid for the scripts and wanted me to get his google ads to show, He isn't paying me much and tells me to leave things how he had them, but try to correct whats going wrong.


    I can't figure out why the site is not loading for you when it's loading fine for me in all 3 browsers. I told you in the beginning I didn't even want to show this site off.
     
    KangBroke, Dec 3, 2015 IP
  18. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #18
    Ooph, loaded it in Vivaldi, wondering if this is why I'm not seeing it....

    [​IMG]

    With that many blocked items reporting, I'm not sure I dare turn that off to check... Dimes to dollars that's why I'm not seeing the parts you are having issues with.
     
    deathshadow, Dec 3, 2015 IP
  19. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #19
    KangBroke, Dec 3, 2015 IP
  20. KangBroke

    KangBroke Notable Member

    Messages:
    1,026
    Likes Received:
    59
    Best Answers:
    4
    Trophy Points:
    265
    #20
    What are you using to see that error? I'd like to see that as well so I can try to help him out a bit
     
    KangBroke, Dec 3, 2015 IP