Skip to content
Browse files

Handle multibyte values in sample protocol generator

* Length needs to be number of bytes not number of characters
* Fixes 'RR Protocol error: expected '$', got ' error
* Ruby 1.8.7+ compatible
  • Loading branch information...
1 parent c4328a8 commit 77c9594e628cee76b3b6ed1618f7b11c104578f6 @thetamind thetamind committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 topics/mass-insert.md
View
2 topics/mass-insert.md
@@ -99,7 +99,7 @@ The following Ruby function generates valid protocol:
proto = ""
proto << "*"+cmd.length.to_s+"\r\n"
cmd.each{|arg|
- proto << "$"+arg.length.to_s+"\r\n"
+ proto << "$"+arg.to_s.bytesize.to_s+"\r\n"
proto << arg.to_s+"\r\n"
}
proto

0 comments on commit 77c9594

Please sign in to comment.
Something went wrong with that request. Please try again.