2017-03-07 12 views
0

私はそれをすばやく理解しやすくしようとします。私はそれを修正するために何もできないPHPで私のプロジェクトに問題があります。私は自分のウェブサイトにCKEditorのインスタンスを持っています。CKEditorがutf-8に保存されていません

これは、configおよびインスタンスです:

<script src="assets/ckeditor/ckeditor.js" charset="UTF-8"></script> 

<textarea class="ckeditor" name="editor1" id="editor" rows="10" cols="80" required value="<?php if($error) echo $profdesc; ?> "> 
      <?php echo $profdesc; ?> 
    </textarea> 

    <script> 
     CKEDITOR.replace('editor1', { 
     contentsCss: "assets/ckeditor/test.css", 
     uiColor: '#428bca', 
     extraPlugins: 'wordcount,lineheight,colorbutton,smiley', 
        wordcount: { 
         showWordCount: true, 
         showParagraphs: false, 
         showCharCount: true, 
         maxCharCount: 3000, 
         paragraphsCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationparagraphs").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - paragraphs").show(); 
         }, 
         wordCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationword").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - word").show(); 
         }, 
         charCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationchar").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - char").show(); 
         }, 
         charCountLessThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationchar").css("background-color", "white").css("color", "black").hide(); 
         }, 
         paragraphsCountLessThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationparagraphs").css("background-color", "white").css("color", "black").hide(); 
         }, 
         wordCountLessThanMaxLengthEvent: function (currentLength, maxLength) { 
          $("#informationword").css("background-color", "white").css("color", "black").hide(); 
         } 
        } 
       }); 
    </script> 

すべてが、私はこのエディタで「説明」を更新するまで、私はUTF-8にすべての私のテーブルとMySQLを持っている...正常に動作し、あるいは少なくとも私はそれを持っていると思う。 UPDATE SQLに問題がある可能性があります。残りのコードはここにあります。 この場合、私は "Olá"をDBに保存しようとしています。

if(mysqli_query($con, "UPDATE users SET username='" . $name1 . 
     "',description='" . $descr . "',gender='" . $gender . 
     "',location='" . $location . "',ocupation='" . $ocupation . 
     "' WHERE user_id = '" . $_SESSION['usr_id'] . "'")) 

これは、DB上の結果は次のとおりです。 enter image description here

+0

が列/テーブルは 'キャラクタ・セットUTF8であることを確認してください私がしなければならなかったすべては入れていました'(またはutf8mb4) –

答えて

1

が、私はそれを修正するために管理しました!

mysqli_set_charset($con, 'utf8'); 

前:

if(mysqli_query($con, "UPDATE users SET username='" . $name1 . "',description='" . $descr . "',gender='" . $gender . "',location='" . $location . "',ocupation='" . $ocupation . "' WHERE user_id = '" . $_SESSION['usr_id'] . "'")) { 

そして結果だった:「OLA」

関連する問題