<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Helvetica Neue";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Verdana",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">The switch from MySQL’s broken “utf8” character encoding to the not-broken “utf8mb4” was one of the main things involved in the massive
 3.2 to 3.3 version move.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">As a result of the database changes that all that led to, v 3.3 was at first pretty buggy. However, it’s now reasonably stable. I would
 say that if you are a non-technically-naïve user then you are now safe to go to v 3.3.11 … and have your non-BMP characters behave themselves.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">One of the things that’s now non-buggy (or, at least,
<i>less</i>&nbsp; buggy) is the user corpus system. Documentation still lacking alas. If you want to see what it’s like, it’s going to be rolled out on the Lancaster server incrementally over the next three weeks (ish) (<a href="https://cqpweb.lancs.ac.uk">https://cqpweb.lancs.ac.uk</a>)
 ; feel free to have a play and let me know if you see issues.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">best<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Andrew.<o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></i></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Verdana&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> cwb-bounces@sslmit.unibo.it &lt;cwb-bounces@sslmit.unibo.it&gt;
<b>On Behalf Of </b>Thilo Wiertz<br>
<b>Sent:</b> 18 November 2021 20:13<br>
<b>To:</b> CWBdev Mailing List &lt;cwb@sslmit.unibo.it&gt;<br>
<b>Subject:</b> Re: [CWB] CQPweb error creating frequency tables (Invalid utf8 character string)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">Thanks Jörg, this saved my week!&nbsp; <o:p></o:p></p>
<div>
<p class="MsoNormal">Thanks Stephanie, while not needed for this corpus, that patch is likely to become very handy soon!
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">If anyone is interested in the solution, a simple regex does the trick:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">re_pattern&nbsp;=&nbsp;re.compile(u'[^\u0000-\uFFFF]',&nbsp;re.UNICODE)<br>
return&nbsp;re_pattern.sub(u'\uFFFD’,&nbsp;str_var_with_wicked_chars)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">(Replaces all unicode code points outside the range 0-FFFF by&nbsp;<span style="font-size:12.5pt;font-family:&quot;Tahoma&quot;,sans-serif;color:#202D4A">�</span><span style="font-size:12.5pt;font-family:&quot;Helvetica Neue&quot;;color:#202D4A">)</span>
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Best,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thilo<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Am 18.11.2021 um 20:04 schrieb Stefan Evert &lt;<a href="mailto:stefanML@collocations.de">stefanML@collocations.de</a>&gt;:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">The CQPweb v3.2 server running on my laptop has the following patch around line #347 of file lib/sql-lib.php, in function do_sql_infile_query():<br>
<br>
<br>
$sql = &quot;{$Config-&gt;mysql_LOAD_DATA_INFILE_command} '$filepath' INTO TABLE `$table`&quot;;<br>
<br>
$sql .= &quot; CHARACTER SET utf8mb4&quot;; /* PATCH to handle characters outside BMP */<br>
if ($no_escapes)<br>
$sql .= ' FIELDS ESCAPED BY \'\'';<br>
<br>
return do_sql_query($sql);<br>
<br>
This has helped me get Twitter corpora into CQPweb, but I don't know if it is sufficient for your data.<br>
<br>
Best,<br>
Stephanie<br>
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">On 18 Nov 2021, at 17:47, Jörg Knappen &lt;<a href="mailto:j.knappen@mx.uni-saarland.de">j.knappen@mx.uni-saarland.de</a>&gt; wrote:<br>
<br>
This is a known shortcoming of the Database (mysql/MariaDB). It can only handle characters in the Basic Monolingual Plane (BMP). Since emojis (I suspect these because of the provenance of your data, there are also additional Chinese characters, mathematical
 and alchemy symbols, and many historic scripts in that area) are outside that plane with codepoint &gt;= 0x10000 they cause this error.<br>
<br>
You can write a script searching for all characters with such codes, and you can try to replace them with some replacement strings to carry on.<br>
<br>
<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>