2009/2/19 Tanaka Akira <akr / fsij.org>: > In article <op.upklh9q19245dp / kool>, > "Michael Selig" <michael.selig / fs.com.au> writes: > >> In more detail: I have a legacy system that uses fixed length fields. Yes, >> a name is variable length, but some old systems use a fixed length field, >> say 40 chars, which is space filled on the right (or truncated). In my >> case, the data input is by a form, and each field is fixed width. I am >> changing the system so that the SAME forms can be used, but extended to >> use UTF-8 not just ASCII. So this means that the number of characters is >> still fixed, but the number of bytes is no longer fixed. I do *not* want >> to change the format of the file (though it probably should be, but that >> would be a lot more work), because I want the application to be backward >> compatible (when using ASCII data). > > This is what I'd like to hear. Thank you for explanation. > > It seems the number, 40, is a number for "big enough for > names". > > Why don't you use 40 bytes data format, both with Ruby 1.8 > and 1.9? > > Do you think that 40 bytes is not big enough for names in > some country? > > If the data format uses 40 bytes, instead of 40 chars, > it is easy to read it in Ruby 1.8, even if it contains UTF-8 > chars. > While this might ease working with the file data it might make designing the form more challenging. The things to consider: - checking for byte length rather than character length in something like JavaScript (probably possible) - explaining the length limit to the user of the application (I would not want to do that) - making sure that 40 bytes is long enough for names in languages that use exotic characters Thanks Michal