Handling null chars in handle names

4 views
Skip to first unread message

Joe Tseng

unread,
Jun 3, 2018, 10:58:40 AM6/3/18
to twitter-...@googlegroups.com

I’m testing out a download script I wrote and I came across a really weird Twitter handle name. In my script I have this line:

 

@logger.debug("Processing #{_twitter_user.screen_name}")

 

And I got this output in my log:

 

DEBUG -- : Processing  L a c i L o u 7 7

 

This handle causes my script to crash with the following error msg:

 

C:/Ruby/23-x64/lib/ruby/gems/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:625:in `exec_prepared': string contains null byte (ArgumentError)

 

I put a put statement in the script and I got: \u0000L\u0000a\u0000c\u0000i\u0000L\u0000o\u0000u\u00007\u00007

 

I’m sure I can figure out how to handle processing null chars; I’d still love to see other people’s solutions. Question is: what does the handle look like in Twitter/URL? I tried simply inserting the handle string from the log output into the URL and I got a Page Doesn’t Exist error. It seems the logger simply replaced \u0000 with spaces and that totally changes the handle name.

 

  • Joe

 

Reply all
Reply to author
Forward
0 new messages