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
CBCODEC(1)						      Quick Database Manager							CBCODEC(1)

NAME
cbcodec - popular encoders and decoders SYNOPSIS
cbcodec url [-d] [-br] [-rs base target] [-l] [-e expr] [file] cbcodec base [-d] [-l] [-c num] [-e expr] [file] cbcodec quote [-d] [-l] [-c num] [-e expr] [file] cbcodec mime [-d] [-hd] [-bd] [-part num] [-l] [-ec code] [-qp] [-dc] [-e expr] [file] cbcodec csv [-d] [-t] [-l] [-e expr] [-html] [file] cbcodec xml [-d] [-p] [-l] [-e expr] [-tsv] [file] cbcodec zlib [-d] [-gz] [-crc] [file] cbcodec lzo [-d] [file] cbcodec bzip [-d] [file] cbcodec iconv [-ic code] [-oc code] [-ol ltype] [-cn] [-wc] [-um] [file] cbcodec date [-wf] [-rf] [-utc] [str] DESCRIPTION
This manual page documents briefly the cbcodec commands. cbcodec is a tool to use encoding and decoding features provided by Cabin. This command is used in the above format. file specifies a input file. If it is omitted, the standard input is read. OPTIONS
A summary of options is included below. For a complete description, see the file:///usr/share/doc/qdbm-doc/spex.html#cabincli. -d perform decoding (unescaping), not encoding (escaping). -br break up URL into elements. -rs resolve relative URL. -l output the tailing newline. -e expr specify input data directly. -c num limit the number of columns of the encoded data. -hd parse MIME and extract headers in TSV format. -bd parse MIME and extract the body. -part num parse MIME and extract a part. -ec code specify the input encoding, which is UTF-8 by default. -qp use quoted-printable encoding, which is Base64 by default. -dc output the encoding name instead of the result string when decoding. -t parse CSV. Convert the data into TSV. Tab and new-line in a cell are deleted. -html parse CSV. Convert the data into HTML. -p parse XML. Show tags and text sections with dividing headers. -tsv parse XML. Show the result in TSV format. Characters of tabs and new-lines are URL-encoded. -gz use GZIP format. -crc output the CRC32 checksum as hexadecimal and big endian. -ic code specify the input encoding, which is detected automatically by default. -oc code specify the output encoding, which is UTF-8 by default. -ol ltype convert line feed characters, with `unix'(LF), `dos'(CRLF), and `mac'(CR). -cn detect the input encoding and show its name. -wc count the number of characters of the input string of UTF-8. -um output mappings of UCS-2 characters and C strings of UTF-16BE and UTF-8. -wf output in W3CDTF format. -rf output in RFC 1123 format. -utc output the coordinate universal time. SEE ALSO
qdbm(3), cabin(3). AUTHOR
QDBM was written by Mikio Hirabayashi <mikio@fallabs.com>. This manual page was written by Fumitoshi UKAI <ukai@debian.or.jp>, for the Debian project (but may be used by others). Man Page 2005-05-23 CBCODEC(1)