• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Text not wrapping

I don't understand why the text is not wrapping on the following page:

http://www.blueapplehouses.com/wrap_problem.html
0
hrolsons
Asked:
hrolsons
  • 6
  • 3
  • 3
1 Solution
 
HainKurtSr. System AnalystCommented:
try this

you have some strange characters between words, it is not space but A0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<BODY>
<table border=1 width=300>
<tr><td>
there is a check that came in for $xxx.xx from xxx xxx. It doesn`t reference your xxx house, but I`m assuming its from there. The stub on the check references a washing machine, and in red it says:
</td></tr></table>	
</body></html>

Open in new window

0
 
hrolsonsAuthor Commented:
This was just an example, in the real page I'll be displaying data from a database.  What is "A0" and how can I search for and replace it before displaying the data?  Also, how did you figure out there were strange characters?
0
 
HainKurtSr. System AnalystCommented:
I am using ultraedit
a nice editor ;) not free, you can use notepad++ for the same purpose, and it is free
turn on the hex view to see the character codes... A0

chech here

http://www.simotime.com/asc2ebc1.htm

A0 = 160
32 = 20 : space character

you can use replace(s, ascii(160), ascii(32)) before printing to page...

I am not sure exactly what is the real command in php, use above as a reference... you can add this either to query, or after getting the data, use this before sending/printing to the page...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
SoLostCommented:
First, unless this is data that you're getting from a MySQL database this shouldn't be in the MySQL Server zone as it has nothing to do with MySQL.

Second, it would appear that your spaces aren't "spaces".

If I view the source of your page in a hex editor your spaces show up as HEX "A0" where as on a regular page they show up as HEX "20".

As far as the browser is concerned, since there are no spaces, then there is nothing to wrap.
0
 
SoLostCommented:
Whoops, someone beat me to it.
0
 
HainKurtSr. System AnalystCommented:
you are tooooo slow ;)
0
 
hrolsonsAuthor Commented:
Yes, it is coming from a mySQL db.
0
 
HainKurtSr. System AnalystCommented:
use this

select ..., replace(field_name,CHAR(160),CHAR(32)) as field_name from ...

instead of just

select ..., field_name from ...
0
 
HainKurtSr. System AnalystCommented:
or just update your db with

update myTable set col_with_160s = replace(col_with_160s,CHAR(160),CHAR(32))

once your data is fixed, no change is required... I prefer this if no new data will come in existing format...
0
 
SoLostCommented:
Yes, fixing the data in the database is the way to go but you also have to figure out how it got to be that way in the first place to avoid it happening again.

How was the data inserted into the table?
0
 
hrolsonsAuthor Commented:
Great, I used this php code and it works perfect:

$field=str_replace(CHR(160),CHR(32),$field);

Now I'm looking at how I wrote the data to the table in the first place.  Should I mention it here or start a new thread?
0
 
HainKurtSr. System AnalystCommented:
new thread new points ha ha ;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 6
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now