Categories > TinyButStrong general >

Tables showing garbage characters

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Asfihani
Date: 2008-06-19
Time: 07:10

Tables showing garbage characters

Anybody know, when using table with MySQL UTF-8 always displaying garbage character below:
<
but it work perfectly with default block.

Any help are appreciated


jamu.php contains:
<?php

include_once('tbs_class.php') ;
require('config.inc.php');

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('tblInbox.html','UTF-8') ;
$TBS->MergeBlock('blk1',$cnx_id,'select ReceivingDateTime,SenderNumber,TextDecoded from inbox order by ReceivingDateTime desc') ;
$TBS->MergeBlock('blk2',$cnx_id,'select ReceivingDateTime,SenderNumber,TextDecoded from inbox order by ReceivingDateTime desc') ;
mysql_close($cnx_id) ;
$TBS->Show() ;


?>

tblInbox.html contains:
<table border="1" align="center" cellpadding="2" cellspacing="0">
  <tr bgcolor="#CACACA">
    <td width="10"><strong>No</strong></td>
    <td width="100"><strong>Pengirim</strong></td>
    <td width="150"><div align="center"><strong>Tanggal</strong></div></td>
    <td width="400"><div align="center"><strong>Isi</strong></div></td>
  </tr>
  <tr bgcolor="#F0F0F0">
    <td>[blk1.#]</td>
    <td>[blk1.SenderNumber;block=tr]</td>
    <td><div align="center">[blk1.ReceivingDateTime;frm='dd/mm/yyyy hh:mm:ss']</div></td>
    <td>[blk1.TextDecoded;ope=max:50]</div></td>
  </tr>
  <tr bgcolor="#E6E6E6">
    <<td>[blk1.#]</td>
    <td>[blk1.SenderNumber;block=tr]</td>
    <td><div align="center">[blk1.ReceivingDateTime;frm='dd/mm/yyyy hh:mm:ss']</div></td>
    <td>[blk1.TextDecoded;ope=max:50]</div></td>
  </tr>
  <tr bgcolor="#E6E6E6">
    <td colspan="4" bgcolor="#FFCFB9">[blk1;block=tr;nodata]There is no data. </td>
  </tr>
</table>
<p align="center">There are [blk1.#] displayed lines.</p>
<center>
<br>
<p>
No =>  SenderNumber => ReceivingDateTime => TextDecoded<br>
[blk2;block=begin]
[blk2.#] => [blk2.SenderNumber] => [blk2.ReceivingDateTime] => [blk2.TextDecoded;ope=max:50]<br>
[blk2;block=end]
</center>
By: Asfihani
Date: 2008-06-19
Time: 07:11

Re: Tables showing garbage characters

Upss, you can see result here: http://203.84.155.121/jamu.php
By: TomH
Date: 2008-06-19
Time: 13:03

Re: Tables showing garbage characters

This symtom is common in tables. Because the browser cannot decode the purpose of the extraneous open tags in a table it throws them outside the table when it renders on screen. You can look at your browser 'page source' to see the extra tag shows in it's location in the table but the brower throws it to the top of screen when rendering.

Then you just look at your HTML... In the second row of your block, you have an extra &lt; at the opening cell tag -this is being repeated three times by TBS MergeBlock process.

<tr bgcolor="#E6E6E6">
    <<td>[blk1.#]</td>

TBS cannot help you if your HTML is incorrect ;)

Hope that helps,
By: Asfihani
Date: 2008-06-20
Time: 01:20

Re: Tables showing garbage characters

Really well spot, TomH. I really didn't notice about double tag. Thank you for spotting my silly typos. Now, it worked.