# Unicode and sprintf method

**URL:** <https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883>\
**Category:** Ruby\
**Created:** [June 17, 2006, 10:12pm UTC](https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883 "2006-06-17T22:12:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [June 17, 2006, 10:12pm UTC](https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883/1 "2006-06-17T22:12:27Z")

</div>

I noticed that they does not work (ehdn used with jcode), I guess it’s  
because sprintf calls size and not jsize method of string, and jcode  
does not redefine sprintf (and many other methods).

Is that true and is there any easy tip at least for sprintf method.

thanks,  
Bojan M.

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [June 17, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883/2 "2006-06-17T22:25:01Z")

</div>

On 17/06/06, Bojan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I noticed that they does not work (ehdn used with jcode), I guess it’s  
> because sprintf calls size and not jsize method of string, and jcode  
> does not redefine sprintf (and many other methods).
> 
> Is that true and is there any easy tip at least for sprintf method.

Can you show a short example of the problem?

Paul.

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [June 17, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883/3 "2006-06-17T22:34:22Z")

</div>

Paul B. wrote:

> 

sure,

sprintf("%-10.10s", “Å ÄÄ?Ä?Å½Å¡Ä?ÄÄ?Å¾”)

should return same string but they get cut to 5 characters only. These  
are unicode characters for central european languages.

best regards,  
Bojan M.

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [June 18, 2006, 8:07pm UTC](https://www.ruby-forum.com/t/unicode-and-sprintf-method/95883/4 "2006-06-18T20:07:01Z")

</div>

On 17-jun-2006, at 22:32, Bojan M. wrote:

> sure,
> 
> sprintf("%-10.10s", “Å ÄÄ?Ä?Å½Å¡Ä?ÄÄ?Å¾”)
> 
> should return same string but they get cut to 5 characters only.  
> These are unicode characters for central european languages.

Aie. We gotta take care of that now in our plugin. Thx for the headsup.
