Skip to content

Instantly share code, notes, and snippets.

@dublado
dublado / gist:1478465
Created December 14, 2011 20:52
utf8 converter fixer
<pre><?php
$var = "Not%c3%adcias";
echo $var;
echo "\n";
echo htmlentities($var);
echo "\n";
echo urlencode($var);
echo "\n";
@mudge
mudge / gist:428455
Created June 7, 2010 09:29
Namespaces with Nokogiri::Builder
# Dealing with namespaces in Nokogiri.
#
# First thing you must do is abandon what you're used to with Builder,
# namespaces aren't just attributes on an element, they uniquely identify
# what sort of element you are building and, as such, you are better off
# specifying them manually.
#
# The key here is accessing the Nokogiri::XML::Element being built with
# b.parent, then you can set the namespace (distinguished by an element
# with a prefix such as "soap12:Envelope") or add a default namespace