V4RB, Jon, project /// More explanation.

erne ernestogiannotta at tiscalinet.it
Wed Sep 15 19:44:01 CDT 2004


on 15-09-2004 18:44, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:

>>> sorry, I still not catch
>>> 
>>> say I define some field as UTF8 10 chars maxlenght
>>> I store some 10 chars string with no double bytes chars ("abcdefghij")
>>> the Vale kernel converts all in UTF16
>>> 
>>> result: I loose half my data
>>> 
>>> I got it well?
>>> 
>> 
>> No -- at least that's not how I understand it.
> 
> Yes, Jon, you loose.
> 
> On disk is reserved 10 bytes for Vstring field.
> So if you put 10 chars each 2 bytes then this is 20 bytes.
> On disk can be stored only 10 bytes.
> 

well... but I decided to use UTF8, remember?
(for all the good reasons that Erik stated)
so I expect all 10 bytes to be saved

> 
> If, Erne, you will use VarChar(504), then all your 20 bytes will be written
> to disk. No problems.
> 

but not all my 504 ;^)

> 
> -------------------
> Everything is simple, guys.
> 
> 
> I offer you to remember such rules:
> 
> * if you use UTF16, and you make some
> 
> Vstring(50)     -- this is 50 chars
> VarChar(50)     -- this is 50 chars
> Text            -- unlimited
> 
> in this case Valentina allocate on disk bytes
> 
> Vstring(50)     -- 50 * 2 = 100 bytes on disk
> VarChar(50)     -- 4KB+ pages.
> 
> 
> * if you use any other encoding then you use single byte encoding.
> And in this case if you say
> 
> Vstring(50) -- you reserve 50 bytes on disk.
> 
> if your chars eat one byte, then you get 50 chars.
> if your chars eat 2 bytes then you get 25 chars.
> 
> So if you will think in bytes then everything is clear.
> 

not at all!!

you just stated that Vale will convert those 1 byte chars to 2 bytes UTF16
internally and thus consume all 50 bytes for 25 chars only

or I still don't get something?

> 
> 
> --------------
> Just in all both above cases we can THINK that we work with chars.
> in all EXCEPT UTF-8
> 
> SQL Standard also require to think in chars.
> 
> As for me, I prefer to control each byte. I am Developer.
> 

yep! and this ambiguity about available space depending on defined encoding
is sure cause of headaches IMHO



Cool Runnings,
Erne.

-- 
| e r |  Ernesto Giannotta
| n e |  Musical Box - a media store
                   




More information about the Valentina-beta mailing list