special chars in generated vCard problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
imme
Forum Newbie
Posts: 14
Joined: Fri Nov 21, 2003 11:51 am

special chars in generated vCard problem

Post by imme »

Hi there,
I got this PHP code that creates a vCard from data out of a MySQL database. I all works perfectly fine except for the special characters (since I'm from Germany these would be ö,ä,ß and so on) they all get lost on the way. What do I need to do to fix this.

thanks for your help. :-)

Code: Select all

<?php 
ob_start(); 
include("connect.php"); 

... bunch of MySQL Statements 

?> 
BEGIN:VCARD 
VERSION:3.0 
N:<?php echo @mysql_result($name, 0, 1); ?>;<?php echo @mysql_result($name, 0, 2); ?>;;; 
FN:<?php echo @mysql_result($name, 0, 2) . " " . @mysql_result($name, 0, 1) . "\n"; ?> 
ORG:<?php echo @mysql_result($name, 0, 6); ?>; 
TITLE:<?php echo @mysql_result($name, 0, 6) . "\n"; ?> 
EMAIL;type=INTERNET;type=HOME;type=pref:<?php echo @mysql_result($emailprivat, 0, 0) . "\n"; ?> 
EMAIL;type=INTERNET;type=WORK:<?php echo @mysql_result($emailfirma, 0, 0) . "\n"; ?> 
TEL;type=HOME:<?php echo @mysql_result($telefonprivat, 0, 0) . "\n"; ?> 
TEL;type=WORK:<?php echo @mysql_result($telefonfirma, 0, 0) . "\n"; ?> 
TEL;type=FAX:<?php echo @mysql_result($telefonfax, 0, 0) . "\n"; ?> 
TEL;type=CELL;type=pref:<?php echo @mysql_result($telefonmobil, 0, 0) . "\n"; ?> 
item2.ADR;type=HOME;type=pref:;;<?php echo @mysql_result($adresseprivat, 0, 0); ?>;<?php echo @mysql_result($adresseprivat, 0, 2); ?>;;<?php echo @mysql_result($adresseprivat, 0, 1); ?>;<?php echo @mysql_result($adresseprivat, 0, 3) . "\n"; ?> 
item2.ADR;type=WORK;type=pref:;;<?php echo @mysql_result($adressefirma, 0, 0); ?>;<?php echo @mysql_result($adressefirma, 0, 2); ?>;;<?php echo @mysql_result($adressefirma, 0, 1); ?>;<?php echo @mysql_result($adressefirma, 0, 3) . "\n"; ?> 
BDAY;value=date:<?php echo @mysql_result($geburtstag, 0, 0) . "\n"; ?> 
END:VCARD 
<?php 
$filename=@mysql_result($name, 0, 2) . " " . @mysql_result($name, 0, 1); 
header("Content-type: text/x-vcard"); 
header("Content-Disposition: attachment; filename=$filename.vcf"); 

mysql_close(); 
ob_end_flush(); 
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

maybe... [php_man]htmlentities[/php_man]() or [php_man]htmlspecialchars[/php_man]() ... however, I'm entirely unsure..
Post Reply