472,119 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

how to write special character string "Broschüren" into this format Broschüren

245 100+
Hey all,
I am creating a xml file in this format

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  2. <customers>
  3.   <customer>
  4.     <category>Brosch&uuml;ren</category>
  5.     <number>4</number>
  6.     <email>abc@xyz.net</email>
  7.     <name>ABC XYZ</name>
  8.     <farben>4</farben>
  9.     <preflight>1</preflight>
  10.     <format>148 210</format>
  11.     <paper>135</paper>
  12.   </customer>
  13. </customers>
  14.  
But i want category tag in this format which shows special charactor.

Expand|Select|Wrap|Line Numbers
  1. <category>Broschüren</category>
  2.  
In database category values are saved in this format Brosch&uuml;ren but when i create xml then i want it shows category in this fornat Broschüren

If some one help me out to sort out my problem then i will be very grateful to him/her.

I am using DOMDocument in order to create xml file at run/execution time. and here is my method of creating xml document

Expand|Select|Wrap|Line Numbers
  1. $dom = new DOMDocument("1.0", "utf-8");
  2. $dom->xmlStandalone = true;

Awaiting a positive response from this great community
Oct 13 '09 #1
7 3677
Dormilich
8,658 Expert Mod 8TB
@neovantage
should be doable… ;)

@neovantage
ah, from me, that is. (in this forum, mostly)

ok, b2b. I’m not aware that you can convert these entities, once the xml is loaded (I’ve experienced decimal entities being converted). but you can always run htmlentities() on the input string beforehand.
Oct 13 '09 #2
neovantage
245 100+
htmlentities() is used to convert those special chractors into string but i have already string. i need to convert string into special charactor while creating an xml.

i mean i need to convert &uuml; to ü while writing my content into xml file
Oct 13 '09 #3
Dormilich
8,658 Expert Mod 8TB
@neovantage
outside XML those entities are nothing but regular characters.
@neovantage
do it before creating the XML

PS. it’s character, not charactor
Oct 13 '09 #4
neovantage
245 100+
I am doing this before creating XML. here is my code

Expand|Select|Wrap|Line Numbers
  1. $nameval=$myCategory->GetCatHierarchyByIdName(FormatString($_POST['cat_id'],"int"),'*');
  2. $nameval=htmlentities($nameval);
  3. $dom = new DOMDocument("1.0", "utf-8");
  4. $dom->xmlStandalone = true;
  5.  
function GetCatHierarchyByIdName returns category name and it saved in variable $nameval and i am aplying htmlentities() function before creating XML File

But it is not working
Oct 13 '09 #5
neovantage
245 100+
Even this technique is also not working

Expand|Select|Wrap|Line Numbers
  1. $nameval=$myCategory->GetCatHierarchyByIdName(FormatString($_POST['cat_id'],"int"),'*');
  2.             $nameval=str_replace("&auml;","ä",$nameval);
  3.             $nameval=str_replace("&ouml;","ö",$nameval);
  4.             $nameval=str_replace("&uuml;","ü",$nameval);
Oct 13 '09 #6
Dormilich
8,658 Expert Mod 8TB
@neovantage
of course not, htmlentities()’s default charset is ISO-8859-1

PS. probably the same reason for the other way
Oct 13 '09 #7
neovantage
245 100+
Thanks it works on remote server
Oct 13 '09 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Bal | last post: by
4 posts views Thread by Norman Uhlenkott | last post: by
7 posts views Thread by Art M | last post: by
25 posts views Thread by lovecreatesbeauty | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.