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
MojoMojo::Formatter::Wiki(3pm)				User Contributed Perl Documentation			    MojoMojo::Formatter::Wiki(3pm)

NAME
MojoMojo::Formatter::Wiki - Handle interpage linking. DESCRIPTION
This formatter handles intra-Wiki links specified between double square brackets or parentheses: [[wiki link]] or ((another wiki link)). It will also indicate missing links with a question mark and a link to the edit page. Links can be implicit (like the two above), where the path is derived from the link text by replacing spaces with underscores (<a href="wiki_link">wiki link</a>), or explicit, where the path is specified before a '|' sign: [[/explicit/path|Link text goes here]] Note that external links have a different syntax: [Link text](http://foo.com). METHODS
format_content_order Format order can be 1-99. The Wiki formatter runs on 10. strip_pre Replace <pre ... with a placeholder reinsert_pre Put pre and lang back into place. format_content Calls the formatter. Takes a ref to the content as well as the context object. format_link <c> <wikilink> <base> [<link_text>] Format a wikilink as an HTML hyperlink with the given link_text. If the wikilink doesn't exist, it will be rendered as a hyperlink to an .edit page ready to be created. Since there is no difference in syntax between new and existing links, some abiguities my occur when it comes to characters that are invalid in URLs. For example, * [[say "NO" to #8]] should be rendered as "<a href="say_%22NO%22_to_%238">say "NO" to #8</a>" * [[100% match]] should be rendered as "<a href="100%25_match>100% match</a>", URL-escaping the '%' * but what about a user pasting an existing link, "[[say_%22NO%22_to_%238]]"? We shouldn't URL-escape the '%' or '#' here. * for links with explicit link text, we should definitiely not URL-escape the link: "[[say_%22NO%22_to_%238|say "NO" to #8]]" This is complicated by the fact that '#' can delimit the start of the anchor portion of a link. * "[[Mambo #5]]" - URL-escape '#' => Mambo_%235 * "[[Mambo#origins]]" - do not URL-escape * "[[existing/link#Introduction|See the Introduction]]" - definitely do not URL-escape Since escaping is somewhat magic and therefore potentially counter-intuitive, we will: * only URL-escape '#' if it follows a whitespace directly * always URL-escape '%' unless it is followed by two uppercase hex digits * always escape other characters that are invalid in URLs expand_wikilink <wikilink> Replace "_" with spaces and unescape URL-encoded characters find_links <content> <page> Find wiki links in content. Return a listref of linked (existing) and wanted pages. SEE ALSO
MojoMojo, Module::Pluggable::Ordered AUTHORS
Marcus Ramberg <mramberg@cpan.org> LICENSE
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-05-23 MojoMojo::Formatter::Wiki(3pm)