title: Convert HTML text stored on mysql LONGTEXT field to a readeable value?
body: <p>I am migrating and old apliccation on ASP. On one page some HTML text is show from a LONGTEXT field from a MySQL database. On the new server only the text that become from this LONGTEXT field is not shown.</p>
  <p>I tried to convert the LONGTEXT to CHAR as suggested here:</p>
  <p><a href="https://stackoverflow.com/questions/9531109/convert-mysql-longtext-value-to-varchar-value">Convert mysql LONGTEXT value to VARCHAR value?</a></p>
  <pre><code>SELECT ID, CAST(YourLongText as char(255)) AS YourVarchar FROM some_table
  </code></pre>
  <p>It works but the text stored is longer that. I tried to use char(10000). The query works on SQL Manager for MySQL but when I use it on the web application it shows nothing (empty).</p>
  <p>Maybe I missed a configuration on IIS. ¿Where should I look? ¿Is there a way to properly CAST the LONGTEXT?</p>
  <p>The text stored on the LONGTEXT is like this:</p>
  <pre><code>&lt;font style=font-family:Tahoma;font-size:12px&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&lt;/p&gt;  &lt;table&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;font style=font-family:Tahoma;font-size:12px&gt;1111111111&lt;/p&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;font style=font-family:Tahoma;font-size:12px&gt;PERSON NAME&lt;/p&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;font style=font-family:Tahoma;font-size:12px&gt;PERSON MIDDLE NAME&lt;/p&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;font style=font-family:Tahoma;font-size:12px&gt;PERSON LASTNAME&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;
  </code></pre>
  <p>I am reading the field on .ASP like this:</p>
  <pre><code>sql = &quot;SELECT ID, CAST(YourLongText as char(255)) AS YourVarchar FROM some_table&quot;
  set rs = db.execute(sql)
  
  if not rs.eof then
  'nothing
  else
  %&gt;  
      &lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;font-family: Tahoma; font-size: 12px&quot;&gt;&lt;%=rs(&quot;YourVarchar&quot;)%&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;%
  end if
  </code></pre>
  <p>EDIT 1: The HTML has nothing wrong. I tried replacing the LONGTEXT with just the text 'Test' and is not showing up neither.</p>