UTF8 Curly Quotes to ASCII
1 2 $xml =~ s/\xe2\x80\x99/\'/gs; 3 $xml =~ s/\xe2\x80\x98/\'/gs; 4 $xml =~ s/\xe2\x80\x9c/\"/gs; 5 $xml =~ s/\xe2\x80\x9d/\"/gs;
DZone Snippets > beutelevision
12869 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Thomas Beutel http://www.beutelevision.com
1 2 $xml =~ s/\xe2\x80\x99/\'/gs; 3 $xml =~ s/\xe2\x80\x98/\'/gs; 4 $xml =~ s/\xe2\x80\x9c/\"/gs; 5 $xml =~ s/\xe2\x80\x9d/\"/gs;
1 2 #!/usr/bin/perl 3 4 use HTML::FromText; 5 use strict; 6 7 my $text = join '',<>; 8 my $html = text2html($text, urls => 1, email => 1, bold=>1, paras => 1, allcaps => 1, tables => 1, bullets => 1, underline=>1); 9 10 print $html;
1 2 C-x ESC-1 ESC-| tohtml RET
1 2 function listToXml(){ 3 var vList = document.getElementById('phonetic'); 4 var vLen = vList.childNodes.length; 5 var vXml = "<ul>"; 6 for(var i = 0; i < vLen - 1; i++){ 7 if(vList.childNodes[i].innerHTML){ 8 vXml = vXml + '<li>' + vList.childNodes[i].innerHTML + '</li>'; 9 } 10 } 11 vXml = vXml + '</ul>'; 12 document.myform.listfield.value = vXml; 13 } 14 15 ... 16 17 <ul id="phonetic" class="sortable boxy" style="margin-left: 1em;"> 18 <li>alpha</li> 19 <li>bravo</li> 20 <li>charlie</li> 21 <li>delta</li> 22 <li>echo</li> 23 <li>foxtrot</li> 24 </ul> 25 26 <form name="myform"> 27 <input type="text" name="listfield" value="" size="60"> 28 <input type="button" value="submit2" name="submit2" onClick="listToXml()"> 29 </form> 30