not possible to set default encoding for htmlspecialchars() and mb_strlen() etc?

Discussion in 'PHP' started by winterheat, Oct 9, 2008.

  1. #1
    it seems that we can always specify UTF-8 for htmlspecialchars() using the 3rd argument

    and for mb_strlen() and other mb functions, set them to use UTF-8 by calling mb_internal_encoding("UTF-8")

    but i wonder, can we somehow set up the PHP on the server to always use UTF-8... maybe in php.ini or by ini_set()?

    otherwise we will need to always remember to specify it each time. thanks.
     
    winterheat, Oct 9, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    If you are using Apache, then edit httpd.conf to use a certain character set.

    Peace,
     
    Barti1987, Oct 9, 2008 IP
  3. winterheat

    winterheat Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hm... do you know if htmlspecialchars() and mb_strlen() will automatically use utf-8 after that?
     
    winterheat, Oct 9, 2008 IP