I have a web application I have been developing locally on my computer, I have recently launched it on my web server with the exact same settings for MySQL, but for some reason I am encountering a character encoding issue where &quot;smart quotes&quot; (’) are being displayed as black triangles with question marks (�), but only on the server. This is on the HTML: &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;  My local MySQL database (without character issues) is MySQL 5.7.26 with an InnoDB table with UTF8MB4 encoding and a table collation of utf8mb4-unicode-ci My server MySQL database (with character issues) is MySQL 5.5.5-10.3.21 with an InnoDB table with UTF8MB4 encoding and a table collation of utf8mb4-unicode-ci Perhaps there is a PHP setting somewhere I am missing? Edit: if I run this script on my computer is works perfectly, but if I run the same script on my server with the same data in the database, it give me the character encoding issue: error_reporting(E_ALL);  include 'dbconfig.php';  $id = 19;  try {     $pdo = new PDO(&quot;mysql:host=$servername;dbname=$dbname&quot;, $username, $password);     $pdo-&gt;setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING);     $pdo-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);     $sql = $pdo-&gt;prepare(&quot;SELECT * FROM products WHERE id=:id&quot;);     $sql-&gt;execute(['id' =&gt; $id]);       var_dump ($sql-&gt;fetch());      while ($row = $sql-&gt;fetch()) {         $data[] = $row;     }      echo json_encode($data);  } catch(PDOException $e) {     //echo &quot;Error: &quot; . $e-&gt;getMessage();     echo &quot;Database Error&quot;; } $conn = null;
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.
I'm attempting a mass update on Contacts via Execute Anonymous. My code gives me the following error:     System.LimitException: Apex CPU Time Limit Exceeded   Here's my code:  List &lt;Contact&gt; contactList = [select Id, Mass_Update_Checkbox__c from Contact Limit 1000];  for (Contact contact : contactList) {     contact.Mass_Update_Checkbox__c = TRUE;  }  update contactList; How can I make a "Movie Clip" node start at a certain frame of the scene? In Obi-Wan's Order 66 warning transmission why didn't he tell the surviving Jedi about the Sith, including Palpatine's true identity? If you've seen the premiere episode of Rebels, you will have seen Obi-Wan's warning message that he broadcast to Jedi throughout the galaxy in RotS. In this message he speaks cryptically &amp; warns of a "dark shadow" falling &amp; to avoid the temple &amp; await a "new hope".   Wouldn't it have been useful to inform the Jedi that their mortal enemy the Sith had returned? And specifically that Palpatine himself was a Sith? You'd assume that the majority of the Jedi who were not in the loop of the Council would be unaware of the existence of the Sith. Yoda mentions a few times that they should keep it under wraps. I think now would've been the time to reveal the truth. The more info the surviving Jedi have the better. Who knows if the likes of Kanan knows anything about the Sith's return! I find Obi-Wan's omission of this information bizarre. In a situation where say a group (or at least a plurality) of men is being addressed — for example on a sign passed by many married men — which is correct?  &quot;Remind your wife.&quot;  or  &quot;Remind your wives.&quot; Programmatically obtain the phone number of the Android phone Who created the veil in the death chamber, and why? Was the veil created by someone or was it always there in HP? What is its purpose? If one can't communicate with the dead through the veil, then what/how do unspeakables learn from the the veil? (except investigating how does it flutter,I suppose,,,,) I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all layers.  I don't see anything in the API that provides easy access to this functionality and couldn't find a good online example but maybe I missed something? What should be done with questions that have been resolved as a comment instead of an answer? I'm trying to go through and provide answers to every unanswered question (search &quot;closed:0 answers:0&quot;), somewhat following the spirit that was blogged about at  .  However, I'm finding this much more difficult than it needs to be, as many of the questions have already been answered without the use of an &quot;answer&quot; - but instead, in the form of a comment by either the OP or another poster. I wouldn't mind reading through and skipping these, as long as there was some appropriate action I could take to at least assist with preventing these questions from being seen again from the same query - either by myself or another SO member.  Is there such an appropriate action?  Should we vote to close?  If so, using what reason? Even if I vote to close, what are the chances that 4 other users will also view the question and also vote to close?  (i.e., will my individual vote even do any good?  Is there any report to show recent close votes, so that others may also review and contribute supporting close votes?) Should we post some sort of an answer - even just something to the effect of &quot;this was already answered by the OP's own comment to his answer (above)&quot;? Would something like this be appropriate to flag for moderator attention, and let the moderators deal with it?  (Or would this be considered too trivial?) Should we rename the question title to something standard that can be used in a search exclusion?  (Maybe &quot;SOLVED:&quot;?)  Basically, how can I help to denote questions as &quot;This question is no longer in active search of an answer - though better answers may still be appreciated.&quot;? I've already reviewed , which was closed as a duplicate of  - but this requires effort on part of a user who may very likely no longer be active. Otherwise, is there something I should be doing to improve my search to filter out these types of questions? I've run across this many times, so I don't consider it to be a rare issue.  However, the last question like this I just ran across, prompting this question, was .  In this case, the question was self-answered by the OP in the form of a comment, this question is the OP's only question, the OP has no other visible activity on SO, and the OP hasn't been seen on SO since he registered and posted the question 5 months ago. Another one I just ran across is .  However, here the &quot;answer&quot; comment was posted by a reputable and recently active SO member.  Should I leave a comment directed at him, asking him to re-post his comment as an answer, or should I post my own answer echoing his comment?  (Or something else?) Yet another is .  Interestingly, the OP actually self-edited the question to include the &quot;SOLVED:&quot; prefix on to the question, instead of posting his resolving comment as an answer (and ideally accepting it) as he was asked to do by another comment.  This brings up another good idea - is there a &quot;standard&quot; we should use to rename the titles on these &quot;resolved but unanswered&quot; posts that could be used as a search exclusion?  (Also added to the above list.) Why is my variable local in one 'while read' loop, but not in another seemingly similar loop? Why do I get different values for $x from the snippets below?  #!/bin/bash  x=1 echo fred &gt; junk ; while read var ; do x=55 ; done &lt; junk echo x=$x  #    x=55 .. I'd expect this result  x=1 cat junk | while read var ; do x=55 ; done echo x=$x  #    x=1 .. but why?  x=1 echo fred | while read var ; do x=55 ; done echo x=$x  #    x=1  .. but why? Java: Detect duplicates in ArrayList? How could I go about detecting (returning true/false) whether an ArrayList contains more than one of the same element in Java?  Many thanks, Terry  Edit Forgot to mention that I am not looking to compare "Blocks" with each other but their integer values. Each "block" has an int and this is what makes them different. I find the int of a particular Block by calling a method named "getNum" (e.g. table1[0][2].getNum(); Answering beyond the question's scope Is answering beyond the scope of the question a valid thing? Or should we just stick to the question asked and ignore any potential bugs which might be present (of course OP is unaware of that, as of now).  To make myself more clear, please have a look at this .  There are 3 answers which talk about the issue asked and that's it. If you look at my answer, I've added an additional point about a potential bug which the OP has missed now (may find out later). So is it a good thing to point out such potential bugs or not? Should this practice be encouraged? How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name? Can there be a notification for those people that participated in the question in the past (either who asked or answered it) once a bounty is started on it? Random bits of my chat die and come back to life during the day Is it "re-offend" or "reoffend"? I want to know whether there is a hyphen in the word re-offend, or if it is spelt reoffend. I looked in Oxford English dictionary and the word "reoffend" appears, but then I checked Merriam-Webster and the word is not in there.  So is reoffend a word or is it re-offend?  I'm in Australia where we observe UK English if that matters. Which spells or abilities are affected by things that care about targeting? Note: this is intended to be a canonical question about whether or not a spell or ability targets so there are multiple sub-questions.   Can Hexproof or Shroud save my creature from ? What about a  that was cast for it's Overload cost? Does shroud prevent me from using the Monstrosity ability of a creature, or from giving it more counters with Proliferate? Can I cast an Aura Enchantment on one of my creatures with Shroud, or an opponent's creature with Hexproof? Or can I use the Equip ability to attach an equipment to one of my creatures with Shroud? Will 's ability trigger when my opponent plays ? And will I have to sacrifice my  if my opponent casts ? Will Shroud or Hexproof prevent an opponent from choosing me with 's ability? Will Hexproof keep one of my creatures from being affected by ? If an Aura or Equipment is attached to a creature with Hexproof, does the Hexproof protect the attached permanent? How to Connect & Share your Internet Connection (Wired & Wireless) I have Ubuntu 12.04 on a HP 430 notebook and this has a single wired internet connection and I would like to share this with a LG Optimus One with Android 2.3.3. I followed  instructions and created a hotspot as shown below, but UbuntuHost is not visible on the LG Optimus One when I enable the Wifi on it.  To summarize, I want my Laptop with an internet connection to act as a WiFi router and access the internet from other devices (LG Optimus One with Android in this case).  What additional steps have to be done? How do I set OS X to boot by default? I set Windows 7 to my Boot Camp. Windows 7 starts now by default in the normal boot. However, I want that OSX boots by default and Windows 7 only as I press ALT and then select it.  How can you set OSX to boot by default? I really hope someone will take a quick look at the following, I would just love to better understand it...  This exercise is from Arnold's "Mathematical Methods of Classical Mechanics", p. 97 in the chapter on d'Alemberts principle:  A rod of weight P, tilted at an angle of 60° to the plane of a table, begins to fall with initial velocity zero. Find the constraint force of the table at the initial moment, considering the table as  (a) absolutely smooth  (b) absolutely rough  (In the first case, the holonomic constraint holds the end of the rod on the plane of the table, and in the second case, at a given point.)"      I must admit, I am pretty unsure on how to do calculations using this "fancy" mathematical kind of physics.  First off, I'm lost with (a). But I'll have a go at (b): As far as I understood, d'Alemberts principle states, that if $M$ is a constraining manifold, $x(q)$ is a curve in $M$ and $\xi$ is a vector perpendicular to $T_xM$, then $x$ satisfies Lagrange's equations  $\frac{d}{dt} \frac{\partial L}{\partial \dot q} = \frac{\partial L}{\partial q} \qquad L = \frac{{\dot x}^2}{2} - U(x)$  iff for the following inner product, we have  $\left(m \ddot x + \frac{\partial U}{\partial x}, \xi \right) = 0$  I guess that's about right so far? The constraint would in this case essentially be $\mathbb S^1$, since the rod moves on a circe around the point in contact with the table. Can we assume that all the rod's mass is at the center of mass?  Would we then have $U(x) = -gx_2$ in this case (where $x_2$ is the vertical component of $x$)?  If yes, then $\partial U / \partial x = -ge_2$. Where $e_1, e_2$ are the horizontal and vertical unit vectors, respectively.  At the inital moment, we have $x = \cos(60°) e_1 + \sin(60°) e_2$, so by d'Alembert's principle we must have  $\left(m \ddot x + \frac{\partial U}{\partial x}, \cos(60°) e_1 + \sin(60°) e_2 \right) = 0$  or written differently  $m \ddot {x_1} \cos(60°) + m \ddot{x_2} \sin(60°) - \sin(60°)g = 0$    So: Is this correct so far? Or am I way off? Is (a) handled any differently up to this point?  Thanks for reading (and hopefully thanks for your helpful reply)!  If anyone could recommend a good problem book (with solutions), in which this kind of mathematical approach is used (I don't know if this is how physicists would actually compute stuff??), I would greatly appreciate it.  Kind regards,  Sam How do I deal with a compromised server?