Re: truncate a mb-string to a given octet length?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Correct me if I'm wrong, but should varchar 255 with a utf8 character set
mean 255 unicode characters, not octets?

On Fri, Jun 12, 2009 at 11:50 AM, Tom Worster <fsb@xxxxxxxxxx> wrote:

> say a table in the db has a varchar(255) column, 255 being the max number
> of
> octets of strings that can go in the column. now say the php script very
> occasionally has to deal with utf8 input strings with octet length > 255 --
> it needs to select rows matching the input string or insert the input
> string.
>
> so what i think i need is a function to truncate a utf8 string to the
> longest valid utf8 string that has octet length <= 255.
>
> is this what mb_strcut() is for? i'm having a hard time understanding the
> man page for that function.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux