Skip to content

Instantly share code, notes, and snippets.

@cabo
Created July 2, 2023 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cabo/7b3f3c249635940f7a9c2d847fd2d097 to your computer and use it in GitHub Desktop.
Save cabo/7b3f3c249635940f7a9c2d847fd2d097 to your computer and use it in GitHub Desktop.
ABNF: Convert RFC 7405 case-sensitive strings to RFC 5234
s = ARGF.read
s.gsub!(/%s"([^"]+)"/) {
"%x#{$1.chars.map{|c|c.ord.to_s(16)}.join(".")}"
}
puts s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment