title: Ruby: Limiting a UTF-8 string by byte-length
body: <p><a href="http://www.rabbitmq.com/tutorials/amqp-concepts.html" rel="noreferrer">This RabbitMQ page</a> states:</p>
  
  <blockquote>
    <p>Queue names may be up to 255 bytes of UTF-8 characters.</p>
  </blockquote>
  
  <p>In ruby (1.9.3), how would I truncate a UTF-8 string by byte-count without breaking in the middle of a character? The resulting string should be the longest possible valid UTF-8 string that fits in the byte limit.</p>