I have a checkbox, which changes the content of a table when it's clicked.  For some reason, my UTF-8 is no longer working after I have submitted the form with ajax.  Ajax:  function showUser() { if (window.XMLHttpRequest) {     xmlhttp = new XMLHttpRequest(); } else {     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() {     if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {         document.getElementById("table").innerHTML = xmlhttp.responseText;     } } xmlhttp.open("GET","getuser.php?customer="+variable); xmlhttp.send(); }   and getuser.php:      $customer = intval($_GET['customer']);     $connection = mysqli_connect('localhost','root','*********','name');    if (!$connection) {     die("Could not connect: " . mysqli_error($connection));     }      if($customer == 1) {     $searchType= 1;     } else {     $searchType= 0;     }      $sql="SELECT * FROM table WHERE type= $searchType";      $result = mysqli_query($connection,$sql);   After this I echo a table with content got from the database. In my database there is some customers that has some special characters in their name. Instead of showing them like usual, it only shows ? in place of those special characters.  Any help? (sry for my bad english)
326
I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.
114665
When I want to execute a php file it's displayed as text in my browser.  I have a VPS at Hostinger I installed Ubuntu 18.04 with Webmin and LAMP(installed automatically).  I checked the installation see below.  apache2 - v and php -v gives me: Apache/2.4.29 and PHP 7.2.24-0ubuntu0.18.04.6  So everything seem to be installed correctly.  My default folder is /var/www/html/ I do not us short tag in my code.  I try to lunch a file called phpinfo.php with content:  &lt;?php phpinfo(); ?&gt;   And plain text appear on the page.  If the file begin with html code it's correctly rendered, even with a .php file. But the php part is not executed. e.g:  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;  &lt;?php phpinfo(); ?&gt;   Render :  Hello  But  &lt;?php phpinfo(); ?&gt;  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;   Render the code as plain text.
51639
I am using .Net framework 2.0 / jQuery to make an Ajax call to a 2.0 web service. No matter what I set the contentType to in the ajax call, the service always returns XML. I want it to return Json!  Here is the call:        $(document).ready(function() {          $.ajax({             type: "POST",             url: "DonationsService.asmx/GetDate",             data: "{}",             contentType: "application/json; charset=utf-8",             dataType: "json",             success: function(msg) {               // Hide the fake progress indicator graphic.               $('#RSSContent').removeClass('loading');                // Insert the returned HTML into the &lt;div&gt;.               $('#RSSContent').html(msg.d);             }           });         });       Here is what the request header looks like in Fiddler:  POST /DonationsService.asmx/GetDate HTTP/1.1 x-requested-with: XMLHttpRequest Accept-Language: en-us Referer: http://localhost:1238/text.htm Accept: application/json, text/javascript, */* Content-Type: application/json; charset=utf-8 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; eMusic DLM/4; .NET CLR 2.0.50727) Host: localhost:1238 Content-Length: 2 Connection: Keep-Alive Pragma: no-cache   I have tried setting the contentType to 'text/json' and get the same results.  Here is the web service method:  &lt;WebMethod()&gt; _ Public Function GetDate() As String      'just playing around with Newtonsoft.Json     Dim sb As New StringBuilder     Dim sw As New IO.StringWriter(sb)     Dim strOut As String = String.Empty      Using jw As New JsonTextWriter(sw)         With jw             .WriteStartObject()             .WritePropertyName("DateTime")             .WriteValue(DateTime.Now.ToString)             .WriteEndObject()         End With         strOut = sw.ToString     End Using      Return strOut  End Function   and here is what it returns:  &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;string xmlns="http://DMS.Webservices.org/"&gt;{"DateTime":"11/13/2008 6:04:22 PM"}&lt;/string&gt;   Does anyone know how to force the web service to return Json when I ask for Json?  Please don't tell me to upgrade to .Net Framework 3.5 or anything like that (I'm not that stupid). I need a 2.0 solution.
115935
I have a form with a textarea. Users enter a block of text which is stored in a database.  Occasionally a user will paste text from Word containing smart quotes or emdashes. Those characters appear in the database as: â€“, â€™, â€œ ,â€  What function should I call on the input string to convert smart quotes to regular quotes and emdashes to regular dashes?   I am working in PHP.  Update: Thanks for all of the great responses so far. The page on Joel's site about encodings is very informative:   Some notes on my environment:  The MySQL database is using UTF-8 encoding. Likewise, the HTML pages that display the content are using UTF-8 (Update:) by explicitly setting the meta content-type.  On those pages the smart quotes and emdashes appear as a diamond with question mark.  Solution:  Thanks again for the responses. The solution was twofold:   Make sure the database and HTML files were explicitly set to use UTF-8 encoding. Use htmlspecialchars() instead of htmlentities().
103665
I am currently using csvsimple to include some external data in a document processed with pdfLaTeX. The entire project uses UTF-8 as encoding. The original data is maintained in an Excel 2010 file, and since Excel does not support exporting to UTF-8 CSV directly, I have to go through a rather cumbersome process:   export to CSV  open with Notepad save from notepad, changing the encoding   This process adds a  to the CSV file - 0xef 0xbb 0xbf. On my Windows desktop, this does not seem to be a problem, but the CI build on a Linux box breaks down with Missing \endcsname inserted.. Is there a way to tell csvsimple to ignore the BOM or do I have to edit it out before the compilation starts?  Related:
86609
Google Search Console is saying:  CLS issue: more than 0.25 (desktop) First detected: 5/27/20 Status: Poor   But the  is simply a table containing UTF-8 text. It has an external style sheet, but no images, scripts, or forms. The one possibly uncommon thing is that I serve it as XHTML. Why would this page experience shift? Strangely, the complaint occurs only for desktop, not for mobile, even though it is a wide table that can be read much better on a large screen. (Note that I'm not especially concerned about performance, etc. itself; the page is mostly only for my own use.  I'm simply curious about how and why layout shift could be detected.) UPDATE: I've found a related problem, which I've posted as
40753
Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my webpage (as in, you press the ` key like you do in  games, etc.), and then have it Ajax itself back to the server in-order to do stuff.  I originally thought the best way would be to just get the text inside the textarea, and then split it, or should I use the keyup event, convert the keycode returned to an ASCII character, append the character to a string and send the string to the server (then empty the string).  I couldn't find any information on getting text from a textarea, all I got was keyup information. Also, how can I convert the keycode returned to an ASCII character?
51615
I developed a chrome extension which extract some data from the user visiting page and I want to transmit them to my database by an AJAX call (my website is a basic wordpress website).  The point is that the ajax response is error 400 and I do not understand where is the problem as I tried to modify my ajax request the best I could.  Here is my AJAX request from content.js  /* Popup clicked */  $('#myOwnCustomToolBar_TT91 #message_to_click form.groupio_form #subscribe').on('click', function(){      chrome.runtime.sendMessage(product_infos);   });    Here is the new background.js file :    chrome.runtime.onMessage.addListener(function(response, sender, sendResponse){          jQuery.ajax({          type:"POST",         url: "https://www.groupio.fr/wp-admin/admin-ajax.php",         contentType: 'json',         dataType: "JSON",         responseType:'json',          data: {             action : "itempricingfunction",             ean : "EANTEST0101010"         },          success:function(data){              alert(data);          },          error: function(errorThrown){             console.log(errorThrown);         }         });  });    Here is my function called itempricingfunction inside the functions.php file of my wordpress theme file  function itempricingfunction(){   $product_ean = (isset($_POST['ean'])) ? htmlentities($_POST['ean']) : NULL; echo json_encode(array('product_ean' =&gt;$product_ean));       exit; }  add_action("wp_ajax_nopriv_itempricingfunction", "itempricingfunction"); add_action("wp_ajax_itempricingfunction", "itempricingfunction");    And finally, when I go to the product page and click on the chrome extension, the response of the ajax call is Error 400.  Thank you very much for your help !
105542
With German umlauts I have to define these characters () and the following MWE is working:  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{listingsutf8} \lstdefinelanguage{rawtext}{} \begin{document} \lstset{extendedchars=true,language=rawtext,basicstyle=\ttfamily,literate=%     {Ä}{{\"A}}1%     {Ö}{{\"O}}1%     {Ü}{{\"U}}1%     {ä}{{\"a}}1%     {ö}{{\"o}}1%     {ü}{{\"u}}1%     {ß}{{\ss}}1% }   \lstinputlisting{test.txt}  \end{document}   With content of test.txt like:  ÄÖÜäöüß abcd-1234   However, what can I do for real UTF8 support. I've created a directory with some international UTF8 filenames. They were displayed with a GUI     and also within a UTF8 compatible shell (bash):  logo.jpg الجزيرة.نت.html חדשות, ידיעות מהארץ והעולם - עיתון הארץ.html Βικιπαίδεια.html Администрация Президента Грузии.html საქართველოს პრეზიდენტის ადმინისტრაცია.html 深圳航空有限责任公司 官网订票享受票价直减！.html 航空券 予約・空席照会・運賃案内・国内線｜ANA.html   But if the output of the ls command is in the file test.txt, the document can not be compiled, because I get errors like   ! Package inputenc Error: Unicode char \u8:�\lst@FillFixed@ not set up for use  with LaTeX.   I'm looking for a rock solid solution to input generated files. As there is no definition, what kind of characters in the source file is used, all kind of UTF8 characters should be possible to use.
16554
When I create a form using the form API, the resulting html includes all sorts of unwanted divs. For example, if I use:  $form = array(     'myFieldset' =&gt; array(         '#type' =&gt; 'fieldset'     ) );   The resulting html looks like this:   &lt;form action="/drupal-7.15/?q=chercheur" method="post" id="form-chercheur" accept-charset="UTF-8"&gt;     &lt;div&gt;         &lt;fieldset class="form-wrapper" id="edit-myfieldset"&gt;             &lt;div class="fieldset-wrapper"&gt;             &lt;/div&gt;         &lt;/fieldset&gt;         &lt;input type="hidden" name="form_build_id" value="form-87Dv5ezVpaLI5mD345ofMkLgPhsv_dawudUp73ePQTc" /&gt;         &lt;input type="hidden" name="form_token" value="sXXINWr7rmParm0tRJoEb6QKGIH_QH-ffRSOtnvxYY0" /&gt;         &lt;input type="hidden" name="form_id" value="form_Chercheur" /&gt;     &lt;/div&gt; &lt;/form&gt;   As you can see, two extraneous divs are added here. They are making the javascript I'm writing uselessly complicated, so I was wondering if there was a way to remove the extraneous divs. Ideally, I would like to obtain something like this:  &lt;form action="/drupal-7.15/?q=chercheur" method="post" id="form-chercheur" accept-charset="UTF-8"&gt;     &lt;fieldset class="form-wrapper" id="edit-myfieldset"&gt;     &lt;/fieldset&gt;     &lt;input type="hidden" name="form_build_id" value="form-87Dv5ezVpaLI5mD345ofMkLgPhsv_dawudUp73ePQTc" /&gt;     &lt;input type="hidden" name="form_token" value="sXXINWr7rmParm0tRJoEb6QKGIH_QH-ffRSOtnvxYY0" /&gt;     &lt;input type="hidden" name="form_id" value="form_Chercheur" /&gt; &lt;/form&gt;   Is this possible?
61794
I have a Partner sending some data to a Triggered Email/Data Extension which includes a column for XML data.   The trigger is erroring and not allowing the data to get to the Data Extension.   Below is what they are sending over. Is the formatting of the XML incorrect?  XML data that I've used in the past in Data Extensions starts with....   &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;   This version of XML starts with... {"XML":  Could that be it?  {"To": {"SubscriberKey": "test@acme.com", "ContactAttributes": {"SubscriberAttributes": **{"XML":** "&lt;root&gt;&lt;ITEM&gt;&lt;ITEM_PRODUCT_NAME&gt;dark chocolate nuts &amp; sea salt&lt;/ITEM_PRODUCT_NAME&gt;&lt;ITEM_PRODUCT_SKU&gt;15127&lt;/ITEM_PRODUCT_SKU&gt;&lt;ITEM_PRODUCT_URL&gt;https://www.test.com/15127.html&lt;/ITEM_PRODUCT_URL&gt;&lt;ITEM_PRODUCT_IMG_URL&gt;https://www.test.com/images/nuts.png&lt;/ITEM_PRODUCT_IMG_URL&gt;&lt;ITEM_QTY&gt;1&lt;/ITEM_QTY&gt;&lt;ITEM_SUBSCRIPTION_PRICE&gt;12.59&lt;/ITEM_SUBSCRIPTION_PRICE&gt;&lt;ITEM_TOTAL&gt;12.59&lt;/ITEM_TOTAL&gt;&lt;/ITEM&gt;&lt;ITEM&gt;&lt;ITEM_PRODUCT_NAME&gt;crunchy peanut butter&lt;/ITEM_PRODUCT_NAME&gt;&lt;ITEM_PRODUCT_SKU&gt;41800&lt;/ITEM_PRODUCT_SKU&gt;&lt;ITEM_PRODUCT_URL&gt;https://www.test.com/images/butter.png&lt;/ITEM_PRODUCT_IMG_URL&gt;&lt;ITEM_QTY&gt;1&lt;/ITEM_QTY&gt;&lt;ITEM_SUBSCRIPTION_PRICE&gt;11.37&lt;/ITEM_SUBSCRIPTION_PRICE&gt;&lt;ITEM_TOTAL&gt;9.55&lt;/ITEM_TOTAL&gt;&lt;/ITEM&gt;&lt;ITEM&gt;&lt;ITEM_PRODUCT_NAME&gt;pear cinnamon &amp; pecan&lt;/ITEM_PRODUCT_NAME&gt;&lt;ITEM_PRODUCT_SKU&gt;17227&lt;/ITEM_PRODUCT_SKU&gt;&lt;ITEM_PRODUCT_URL&gt;https://www.test.com&lt;/ITEM_PRODUCT_URL&gt;&lt;ITEM_PRODUCT_IMG_URL&gt;https://www.test.com/images/apples.png&lt;/ITEM_PRODUCT_IMG_URL&gt;&lt;ITEM_QTY&gt;1&lt;/ITEM_QTY&gt;&lt;ITEM_SUBSCRIPTION_PRICE&gt;12.59&lt;/ITEM_SUBSCRIPTION_PRICE&gt;&lt;ITEM_TOTAL&gt;12.59&lt;/ITEM_TOTAL&gt;&lt;/ITEM&gt;&lt;/root&gt;", "SHIPPING_LNAME": "Tester", "FIRST_NAME": "Test", "LAST_NAME": "Tester", "ORDER_TOTAL_SAVINGS": -5.97, "MERCHANT_ORDER_ID": "1810002352", "SHIPPING_ADDRESS_STATE": "NY", "ORDER_PLACE_DATE_LONG": "Fri 11 January 2019", "SHIPPING_ADDRESS_ZIP": "10004", "ORDER_SHIPPING": 0.00, "CARD_TYPE": "Visa", "ORDER_SUBTOTAL": 47.32, "ORDER_PLACE_DATE_SHORT": "01/11/2019", "SHIPPING_FNAME": "Test", "SHIPPING_ADDRESS_TOWN": "new york", "ORDER_TOTAL": 47.32, "CARD_EXPIRE": "12/2027", "CARD_HOLDER": "Test Tester", "SHIPPING_ADDRESS_1": "75 broad st", "SHIPPING_ADDRESS_2": "fl 23"}}, "Address": "acme@test.com"}}   AMPSCRIPT IN EMAIL Calling the XML....  %%[   var @LOOPINGAPPENDIX  set @LOOPINGAPPENDIX = AttributeValue("LOOPINGAPPENDIX")  set @productRows = BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM", 0)  ]%%   %%[   for @j = 1 to RowCount(@productRows) do       set @productXML = Concat("", Field(Row(@productRows, @j), "XML"), "")      set @ITEMPRODUCTNAME = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_PRODUCT_NAME", 0), 1), "Value"))      set @ITEMPRODUCTSKU = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_PRODUCT_SKU", 0), 1), "Value"))      set @ITEMPRODUCTURL = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_PRODUCT_URL", 0), 1), "Value"))      set @ITEMPRODUCTIMGURL = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_PRODUCT_IMG_URL", 0), 1), "Value"))      set @ITEMQTY = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_QTY", 0), 1), "Value"))      set @ITEMSUBSCRIPTIONPRICE = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_SUBSCRIPTION_PRICE", 0), 1), "Value"))      set @ITEMTOTAL = Trim(Field(Row(BuildRowSetFromXML(@LOOPINGAPPENDIX, "/root/ITEM/ITEM_TOTAL", 0), 1), "Value"))      set @rowColor = Iif(Mod(@j,2) == 0, "#efefef", "#ffffff")   ]%%   %%[endif]%%   %%[next @j]%%
35988
I am programmatically exporting data (using PHP 5.2) into a .csv test file. Example data:   Numéro 1 (note the accented e). The data is utf-8 (no prepended BOM).  When I open this file in MS Excel is displays as NumÃ©ro 1.  I am able to open this in a text editor (UltraEdit) which displays it correctly.  UE reports the character is decimal 233.  How can I export text data in a .csv file so that MS Excel will correctly render it, preferably without forcing the use of the import wizard, or non-default wizard settings?
83765
This AJAX function gets called on a click:  $.ajax({             url: 'site/ajax.php',             data: {id: $('section#single article input:last-of-type').attr('value'), cote: 'like'}         }).done(function(html) {}   It passes the ID of the post (which is contained in a hidden input) for function get_post_meta() that is located in ajax.php. This is what AJAX.php looks like:  $cote = get_post_meta($_GET['id'], 'cote', true); if($_GET['cote'] == 'like') {     $newCote = $cote++;     update_post_meta($_GET['id'], 'cote', $newCote); } else {     $newCote = $cote--;     update_post_meta($_GET['id'], 'cote', $newCote); }   It is suppose to update the custom post's "cote" field, but the problem is that function get_post_meta() is undefined in ajax.php. This is the error message:  Fatal error: Call to undefined function get_post_meta() in /home2/electro/public_html/beta... on line 2
118141
Too often I messed with bad formated BibTeX files from references databases that are infected with active characters  as % or &amp; (usually in the abstract, that is not printed but produce an error anyway) but I can live with this inconvenient and replace those by with \% or \&amp;.   Also with some input encoding errors due to some UTF8 character that cannot be managed by pdflatex. In references this error is more disturbing that in the main text, but in best cases, is only change some greek letter as γ. In others is the insidious zero width U+200B, but with I can search and replace even this character.    The worse for me is the obnoxious U+301, specially when is not in over a consonant but hiding in vowels as normal acute characters, that are perfectly managed using inputenc, i.e., the   normal e character (U+0065) plus U+301 look exactly like the kind é (U+00E9) and so on with á, Á, í, etc., so if is hard detect the poisonous diacritic mark.   Disappointingly, search U+0065 plus U+301 find also the single character U+00E9 and vice versa in some editors, so I ended with the pain of searching &amp; replacing every accented letter (single or double) with the single character versión.    So the question is specifically is: There are clevers ways to sanitize .bib files with U+301 tildes?   (Of course, a more general answer, covering some automagic cleaning of all unrecognized and active characters will be welcome.)  The minimal (not) working example:   \documentclass{article} \begin{filecontents}{test.bib} @article{xx, author={González, M. and Ruíz, P.} title={Mañana hará calor &amp; bochorno con un 90% de humedad} }    \end{filecontents} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[spanish]{babel} \begin{document} Hello  \cite{xx} \bibliography{test} \bibliographystyle{plain} \end{document}
119097
I am seeing a weird indentation for questions loaded via AJAX (i.e., by clicking the n question(s) with new activity link). The following screenshot was taken before I clicked the link:  And this is after the new question was loaded:  A browser refresh resolves the problem (as can be expected). It was tested with Chrome 88 and Firefox 85 on  (Catalina).
52808
I have a form with some checkboxes and inputboxes selectboxes and it shows what the user wants via an ajax call. The problem is that when the user click on the item and the detail page is shown and then decide to go back to the previous page he needs to click and select his previous choice again.  I would like to make WP to store all the options in the session when the button to the detail page is clicked and save actual info in the session and then when he visits the page again the  values will be chcecked in sessions and set if any are found.  Could that be done in WP?  If yes, how?  Let's oversimplify that and say that we have something like this in our form:  &lt;input class="car_color" type="checkbox" name="car_color" value="1" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="2" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="8" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="4" /&gt; &lt;input class="car_color" type="checkbox" name="car_color" value="6" /&gt;   I don't use submit button in my form, it's handled via AJAX on input change.  And in my results get via ajax I have a link to the detail page:  &lt;a class="detail-info-link" href="&lt;?php echo $url ?&gt;"&gt;   Any idea how can I store my values in Session and call them when revisiting/reloading/back button in the browser?  I need to be able to read the session stored stuff and use it via ?Javascript? and trigger my search fuction via ajax which is already working well.  I just need to store (probably before going to $link in href of by detail button and read and send session variables (if they exist).
57784
I'm working on a offline version of a website using jQuery and some xml files. I'm running in to a problem in jQuery when I do a $.ajax call on a xml file jQuery throws a error.  When I look at the error I can tell its loading the XML file because its in the error's responceText property. It seams to work just fine in Firefox.  This is how my call looks  $.ajax({     type: "GET",     url: "Modules/" + ModuleID + "/ModuleContent.xml",     dataType: "xml",     success: function(x) { xml = x; ProcessXML(); },     error: function(x) { alert(x.responceText); } });   When I run this on a web server it works just fine. Its only when I run it from the file its self when I have this problem.  Any ideas on how I can make this work in IE?  Edit: I found the answer to my problem.