Text from text field in mysql database getting cut off on special chars and minus signs when in phpmyadmin or using php.
Hi again there are a few questions relating to this sort of thing however no real definitive answers. I have always had headaches when dealing with text fields that hold descriptions of say 1000-5000 chars now the length is not the issue is is the various chars that people use I had a big issue recently with minus signs cutting off the text on CSV upload so I replaced these with hypens I didn't even know there was a difference and cannot reproduce the different chars with my own keyboard! I thought they had all gone however to my horror I am now working with an XML feed that I will be using to populate a remote website with the details within these descriptions and naturally I get this error
XML Parsing Error: not well-formed Location:
http://www.website.com/clients/clientname/xml/ownwebsite.xml????
Line Number 569, Column 18:2.
Metro Station "
------------------^
Now when I look in the actually xml file the full description is there like so...
<description><![CDATA[Fantastic apartment available for viewing!
Rooms: 2 Bed + Maids Room
Bath: 2.5
Area: 2000 Sq. Ft.
Fully Furnished!!
Right Side
View: Marina View
Access to gym, parking, bar and the beach
For more information or viewing, please call: 12345678910
Nearby:
1. Dubai College - 5minutes
2. Nakheel Metro Station - 5 minutes
3. Mall of Emirates - 10minutes
4. Eternity Medicine Institute(Hospital) - 9 minutes
5. Dubai Airport - 33 minutes
6. Beach - Walking Distance
The 20 Shoreline Apartment buildings that line the east side of The
Trunk features some of the Middle East<br/><br/>In the
trunk, beautiful affordable 4 bed room, 3 bed room , 2 bed room
and 1 bed room Apartments are offered with all modern amenities.
You can enjoy the convenience of world class entertainment, dining and
shopping with majestic oceans views.
Rooms
- Stunning water views
- Ceramic floor tiles
- Solid core entry door with security view hole
- Walk in closest with shelves
- Insulated and double glazed windows
- Tiled balconies
- Overhead lighting
Kitchen
- Highest quality kitchen cabinetry
- Ceramic floor tiles
- Ceramic tiled splash backs
- Selected granite tops
- Twin bowl stainless steel sink with quality mixer tap
- Space and services provided for major appliances
- Track lighting
Bathroom
- Quality vanities with Granite tops
- Ceramic tiled flooring and walls
- Ceramic sanitary ware with matching accessories
- High mirrors and vanity lighting
- Ceramic accessory package to match bathroom design
- Safety glass shower enclosures
- High quality mixer taps
Technology & Security
- High-speed internet access with •future technology-ready• features
- Apartments ready for cable TV and telephones
- Apartments ready for state of the art security system
- High quality switches and outlets
- Security Guard/ Janitor in each building
External Features & Palm Services
- Large underground Parking facilities
- Gardens and Landscape maintained by The Palm
Shoreline Apartments Health And Recreation Clubs
- 5 Health Clubs ( 1 for 4 apartments blocks)
- Access to Clubs for a nominal fee
- All located along the seashore
- All managed by The Palm including pool maintenance
- All with Ground + 1 Floor
- All with Large Swimming Pool
- All with Modern Gym
- All with Children's playground
- All with Restaurants<br/><br/> (unit description)
For more information or viewing, please call: 00971 4 450 8666
Nearby:
1. School -
2. Metro Station �"
3. Shopping Mall �"
4. Hospital �"
5. Dubai Airport �"
6. Beach �"
Mortgage (available or not)
Rental yield:
( tower description and all facilities)
Facilities and amenities like: Balcony - Lobby in the building - double glazed windows - Central AC - waste disposal - 7Floors in the building - has 3 elevators - parking space - 24 hour concierge - internet connection - satellite connection - gym or health club - 24 hour security.
(area description and all facilities and amenities)
Our working hours are:
From Saturday to Thursday 8:30 AM to 8:00 PM
To have more information regarding this property, please call our customer service helpdesk on 00971 4 450 8666 or send us an email; info@apex-brokers.com
To find similar properties you can visit our website: www.apex-brokers.com
For after office working hours, weekend or holidays please call on: 00971 50 917 4500
LIST YOUR RESIDENTIAL OR COMMERCIAL PROPERTY WITH US,
WE HAVE READY CASH BUYERS AND TENANTS LOOKING FOR THE PROPERTIES IN
Emirates hills, Palm Jumeirah, Al Barari, Jumeirah Island, Arabian Ranches, The Villa, Victory Heights, Hattan, Meadows, The Lakes, The Springs, Jumeirah Park, Jumeirah, Dubai Marina, Jumeirah Beach Residence(JBR), Downtown, Business Bay, The Greens, The Views, Jumeirah Lakes Tower (JLT), Tecom, Al Barsha
]]></description>
Yet when in phpmyadmin or echoed in php I only get...
Fantastic apartment available for viewing! Rooms: 2 Bed + Maids Room Bath: 2.5 Area: 2000 Sq. Ft. Fully Furnished!! Right Side View: Marina View Access to gym, parking, bar and the beach
For more information or viewing, please call: 12345678910 Nearby:
1. Dubai College - 5minutes
2. Nakheel Metro Station - 5 minutes
3. Mall of Emirates - 10minutes
4. Eternity Medicine Institute(Hospital) - 9 minutes
5. Dubai Airport - 33 minutes
6. Beach - Walking Distance
The 20 Shoreline Apartment buildings that line the east side of The Trunk feature some of the Middle East
So the aim of this question really is does anyone have a sure fire way of solving 99% of these stupid character issues in php and XML at the moment I just run this on the string in php before writing to XML and it seems to get most things ok but obviously not all aswell as using CDATA tags that are fairly ineffective at what they are supposed to do!
function cleanstrings($string, $field, $rw){
$string = $rw[$field];
$string = ereg_replace(8220,""",$string);
$string = ereg_replace(8221,""",$string);
$string = ereg_replace(147,""",$string);
$string = ereg_replace(148,""",$string);
$string = ereg_replace(8216, "'", $string); // left single quote
$string = ereg_replace(145, "'", $string); // left single quote
$string = ereg_replace(8217, "'", $string); // right single quote
$string = ereg_replace(146, "'", $string); // right single quote
$string = ereg_replace(8226, "•", $string); // bullet
$string = ereg_replace(149, "•", $string); // bullet
$string = ereg_replace(8211, "–", $string); // en dash
$string = ereg_replace(150, "–", $string); // en dash
$string = ereg_replace(8212, "—", $string); // em dash
$string = ereg_replace(151, "—", $string); // em dash
$string = ereg_replace(8482, "™", $string); // trademark
$string = ereg_replace(153, "™", $string); // trademark
$string = ereg_replace(169, "©", $string); // copyright mark
$string = ereg_replace(174, "®", $string); // registration mark
return $string;
}
Thanks in advance for any help I am sure other people must come across this issue regularly!