FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » pgsql and exception
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: pgsql and exception [message #178137 is a reply to message #178118] Mon, 14 May 2012 20:33 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 14.05.2012 15:26, schrieb Une Bévue:
> On 14/05/12 14:56, M. Strobel wrote:
>> how about substr()?
> right I'm testing that however I'm not sure it works with accentuated (UTF-8)
> characters.
>
> for example with :
> --- code ---------------------------------------------------------------
> <?php
> header('Content-Type:text/html; charset=utf-8');
>
> $str="Etre ou ne pas etre, telle est est la question.";
> echo $str."<br />";
> echo strlen($str)."<br />";
> echo substr($str, 0, 16)."<br />";
>
> $str="Être ou ne pas être, telle est est la question."; // Accentuated
> echo $str."<br />";
> echo strlen($str)."<br />";
> echo substr($str, 0, 16)."<br />";
>
> ?>
> ------------------------------------------------------------------------
>
> I get :
> Etre ou ne pas etre, telle est est la question.
> 47
> Etre ou ne pas e
> Être ou ne pas être, telle est est la question.
> 49
> Être ou ne pas
>

Je programme donc je suis.

You get the string length in bytes, which is okay when you want to store it in a
length limited field. If you want the length for display formatting this is a problem.

Good programming languages now make a difference between string length in bytes and
string length in characters.

Did not find this one in PHP.

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:
Next Topic: Re: reading a newline from a properties file
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 06:21:44 GMT 2024

Total time taken to generate the page: 0.06195 seconds