1

How I can keep following characters in my paragraphs and stop them being converted or replaced by ' ' empty one or ? marks. I am trying to save following paragraph: "Nā Tā Tīmoti Kāretū a He Muka i tīmata hei pānui reo Māori anake mā te marea. Pānuihia āna kōrero mō te take i whakaterea te pānui toru tekau tau ki muri."

it's Maori language and I wanted to keep it into my database table without converting them to following. "N T Tmoti Kret a He Muka i tmata hei pnui reo Mori anake m te marea. Pnuihia na krero m te take i whakaterea te pnui�toru tekau tau ki muri."

I am using following code to detect if the paragraph have this type of special maori keywords or not.

$keywords = 'āēīōūĀĒĪŌŪ';
            $keywords_array = array('ā','ē','ī','ō','ū','Ā','Ē','Ī','Ō','Ū');

            for($i=0;$i<count($keywords_array);$i++) {
                if(strpos(str_replace(" ","",$_POST['editor1']), $keywords_array[$i]) !== false) {
                    $found = true;
                }
            }
            if($found) {
                //found one possiblities....keep as it is the paragraph but storing into database like other paragraph:(
                $output = $_POST['editor1'];        
            }

Can anyone tell me how I can stop converting special characters when storing in php mysql database.

Please let me know any solution as now it's quite long that I couldn't find simple solution. thanks

Jimil
  • 650
  • 2
  • 14
  • 37
  • It looks like all of those characters can be represented by the UTF-8 character set, so my advice would be to just make your application use UTF-8 throughout and store it in a table with utf8_general_ci collation. Any reason why that wouldn't work for you? – Isaac Bennetch Aug 05 '18 at 19:47
  • Sorry for later reply but I can't do that so all I have access is through the code so how I can save this characters without them being converted.:( – Jimil Aug 09 '18 at 21:50
  • Quentin if you find this question as duplicate can you please place somewhere url or something so that I can refer it back – Jimil Aug 09 '18 at 21:54
  • Please anyone can provide code snippet for php to how to resolve this – Jimil Aug 09 '18 at 21:55
  • At the very top of your question, there's a link now to the question for which Quentin thinks this is a duplicate: https://stackoverflow.com/questions/279170/utf-8-all-the-way-through. I think that's a good place to start because there is a deep discussion there of maintaining UTF-8 throughout your application. – Isaac Bennetch Aug 12 '18 at 02:23
  • I'm not sure what you're asking me — if you have access to the application code, then you have what it takes to fix this. If you don't, then you can't really fix it no matter what else we'd say here. – Isaac Bennetch Aug 12 '18 at 02:24

0 Answers0