Witam.
Mam plik php w którym w 2 miejscach wystepuje chiński tekst.
Pierwszy w showNames jest wyświetlany poprawnie.
Zaraz poniżej jest showErrorsMsg i w tej sekcji tekst chinski jest cześciowo wyświetlany a cześciowo mam pytajniki w rombach.
Jak wyświetlić poprawnie tekst w showErrorMsg??
Dzieki za każdą pomoc.

  1. <?php
  2. defined('ABSPATH') OR die('This script cannot be accessed directly.');
  3.  
  4. /**
  5.  * The template for displaying pages footers
  6.  *
  7.  * Please do not overload this file directly. Instead have a look at framework/templates/footer.php: you should find all
  8.  * the needed hooks there.
  9.  */
  10. us_load_template('templates/footer');
  11. ?>
  12. <script type="text/javascript">
  13. (function($) {
  14. $(document).ready(function() {
  15.  
  16. var traints_arr = [];
  17. hideErrorMsg();
  18.  
  19. function showNames() {
  20. if ($('body').hasClass('page-id-5476') || $('body').hasClass('page-id-6102')) {
  21. $('.page-id-5476 .l-section h3.sub-head-text,.page-id-6102 .l-section h3.sub-head-text').text('请▒..▒.▒5个▒.▒格▒.▒▒.▒: ' + traints_arr.join(", "));
  22. } else {
  23. $('.page-id-6102 .l-section h3.sub-head-text').text(traints_arr.join(", "));
  24. }
  25. }
  26.  
  27. function showErrorMsg() {
  28. $(".err-msg").text ('More/Less than 5 traits is not allowed.▒▒▒对▒请▒..▒.▒5个▒.▒格▒.▒▒.▒▒▒');
  29. $(".err-msg").fadeIn();
  30. }
  31. function hideErrorMsg() {
  32. $(".err-msg").text ('More/Less than 5 traits is not allowed.▒▒▒对▒请▒..▒.▒5个▒.▒格▒.▒▒.▒▒▒');
  33. $(".err-msg").fadeOut();
  34. }
  35.  
  36. $('.process-request').hide();
  37.  
  38. $(".trait-block").click(function(e) {
  39. e.preventDefault();
  40. if (traints_arr.length < 5) {
  41. $(this).toggleClass("active");
  42. traints_arr = [];
  43. $(".container-trait").find(".trait-block").each(function(index) {
  44. if ($(this).hasClass("active")) {
  45. traints_arr.push($(this).find('.trait-title').text());
  46. }
  47. });
  48. } else {
  49. if ($(this).hasClass("active")) {
  50. hideErrorMsg();
  51. $(this).toggleClass("active");
  52. traints_arr = [];
  53. $(".container-trait").find(".trait-block").each(function(index) {
  54. if ($(this).hasClass("active")) {
  55. traints_arr.push($(this).find('.trait-title').text());
  56. }
  57. });
  58.  
  59. } else {
  60. showErrorMsg();
  61. }