Skip to content

Instantly share code, notes, and snippets.

@hryk
Created October 23, 2012 17:24
Show Gist options
  • Select an option

  • Save hryk/3940194 to your computer and use it in GitHub Desktop.

Select an option

Save hryk/3940194 to your computer and use it in GitHub Desktop.
enc method in related.rb
def enc(s)
encoded = []
s.bytes {|i|
if i < 0x80
encoded << i.chr(Encoding::ASCII)
else
encoded << '%'+i.chr(Encoding::ASCII_8BIT).unpack('H2').join('')
end
}
encoded.join('')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment