How to achieve UTF-8 encoding & URL escape in an xml file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to achieve UTF-8 encoding & URL escape in an xml file?
# 1  
Old 01-04-2012
How to achieve UTF-8 encoding & URL escape in an xml file?

Is there any i can achieve entity escaping, URL escaping & UTF-8 encoded for the xml generated through shell script?
Code:
      #! /bin/bash
      echo "<path>" >> file.xml
      for x in `ls filename*`
      do
      echo -e "\t<dir>" >> file.xml
      echo -e "\t\t<file>$x</file>" >> file.xml
      echo -e "\t<dir>" >> file.xml
      done
      echo "</path>" >> file.xml

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Url encoding a string using sed

Hi I was hoping some one would know if it is possible to url encode a string using sed? My problem is I have extracted some key value pairs from a text file with sed, and will be inserting these pairs as source variables into a curl script to automatically download some xml from our server. My... (5 Replies)
Discussion started by: Paul Walker
5 Replies

2. Linux

Help to Convert file from UNIX UTF-8 to Windows UTF-16

Hi, I have tried to convert a UTF-8 file to windows UTF-16 format file as below from unix machine unix2dos < testing.txt | iconv -f UTF-8 -t UTF-16 > out.txt and i am getting some chinese characters as below which l opened the converted file on windows machine. LANG=en_US.UTF-8... (3 Replies)
Discussion started by: phanidhar6039
3 Replies

3. Shell Programming and Scripting

Use curl to send a static xml file using url encoding to a web page using pos

Hi I am try to use curl to send a static xml file using url encoding to a web page using post. This has to go through a particular port on our firewall as well. This is my first exposure to curl and am not having much success, so any help you can supply, or point me in the right direction would be... (1 Reply)
Discussion started by: Paul Walker
1 Replies

4. Shell Programming and Scripting

Escape Sequence Overide in XML file

Hi I am try to use sed to remove decleration information from an XML file however their are special characters in the string and sed is not able to parse it . I am using the following commond. sed -e "s/xmlns=http://www.abc.com/integration/services/testtemplate1//g" Orginal.xml... (3 Replies)
Discussion started by: jimmyb
3 Replies

5. Shell Programming and Scripting

URL/HTML encoding

Hey guys, looking for a way to encode a string into URL and HTML in a bash script that I'm making to encode strings in various different digests etc. Can't find anything on it anywhere else on the forums. Any help much appreciated, still very new to bash and programming etc. (4 Replies)
Discussion started by: 3therk1ll
4 Replies

6. UNIX for Advanced & Expert Users

.htaccess url encoding

Hi, I tried hard to find out solution but no success. I have put together this code in .htaccess: Rewritecond %{THE_REQUEST} ^{3,9}\ /index\.php\?(+)query=(.*?)&(+)start=(.*?)&(+)\ HTTP/ Rewriterule ^index\.php$ http://subdomain.domain.com/%2/%4? RewriteRule ^(+)/(*)$... (0 Replies)
Discussion started by: LukasB
0 Replies

7. Shell Programming and Scripting

Cygwin vi XML file encoding problem

Hi, I have got a zip (binary) file transferred from MacOS (thus it has additional __MACOSX directory packed inside). On extracting this zip, there are few *.xml files available. When I opened this *.xml file in vim editor using Cygwin (on windows) the editor displayed in the bottom. I tried... (4 Replies)
Discussion started by: royalibrahim
4 Replies

8. Shell Programming and Scripting

replace & with &amp; xml file

Hello All I have a xml file with many sets of records like this <mytag>mydata</mytag> <tag2>data&</tag2> also same file can be like this <mytag>mydata</mytag> <tag2>data&</tag2> <tag3>data2&amp;data3</tag3> Now i can grep & and replace with &amp; for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies

9. Shell Programming and Scripting

bash curl escape & in url

I'm running a curl command in bash, but the & in the middle causes the second half of the line to run in the background, here's what I'm trying to do: lat="37.451" lon="-122.18" url="http://ws.geonames.org/findNearestAddress?lat=$lat&lng=$lon" curl -s "$url" I tried escaping the & with \&,... (4 Replies)
Discussion started by: unclecameron
4 Replies

10. Shell Programming and Scripting

URL encoding

Hi All, I want to do URL encoding using shell script in my project. I decided that the sed is the correct tool to do this. But I am unable achieve what I wanted using sed. kindly help me to get rid of this. My requirement is , there will be one URL with all special character, spaces etc... ... (8 Replies)
Discussion started by: Vichu
8 Replies
Login or Register to Ask a Question
IVMCONFIGCONDITIONS.XML(5)					File Formats Manual					IVMCONFIGCONDITIONS.XML(5)

NAME
IvmConfigConditions.xml - rules for processing hardware conditions by ivman(8) DESCRIPTION
IvmConfigConditions.xml specifies hardware conditions to be caught by ivman(8), and allows running of certain commands when devices emit conditions. IvmConfigConditions.xml is parsed as an XML file. The general form of the file is: <?xml version="1.0" encoding="UTF-8"?> <ivm:ConditionsConfig version="0.1" xmlns:ivm="http://www.eikke.com/ivm"> <ivm:Match name="matchname" value="matchvalue"> <ivm:Condition name="conditionname1" exec="command1" /> <ivm:Condition name="conditionname1" exec="command1" /> </ivm:Match> ... </ivm:PropertiesConfig> Each time a condition is emitted by a device, this file will be parsed. If the Match rule matches the device on which the condition came from, and the Condition rule matches the name of the condition which occurred, then the command specified in the 'exec' option will be exe- cuted. A Match element can have any of the following names: ivm.mountable Whether or not HAL specifies that a device can and should be mounted. Must be "true" or "false". hal.anything The string in place of "anything" will be taken as the name of a HAL property string for the device, and the value of the prop- erty will be compared to the value given. Run 'lshal' to see a list of HAL properties which can be used here. * Match every device. Use with care! As many Matches can be nested as is desired. Condition names usually take the form of something like 'ButtonPressed', which may occur when an ACPI-enabled button is pressed on your machine. See the HAL specification for a full list of possible conditions. The exec attributes of Condition tags support substitution of HAL device properties. This is accomplished by surrounding the property name with $ symbols. For instance, if $hal.volume.mount_point$ is within a command, it will be replaced with the volume's mount point before execution. No character escaping is done in the substitution, but the characters ' and " are replaced with ?, so you can surround the sub- stitution with quotes without fear. Remember that this is an XML file, which means that characters which have a special meaning in XML (entities) need to be escaped. Some characters which are popular in shell scripting (&, <, >) are among these special characters. As a quick reference, & becomes &amp; , < becomes &lt; , > becomes &gt; , ' becomes &apos; and " becomes &quot; . SEE ALSO
ivman(8), IvmConfigBase.xml(5), IvmConfigActions.xml(5) 12 May 2005 IVMCONFIGCONDITIONS.XML(5)