Skip to content

2009.07.18 06:13

PHP 언어디코딩

조회 수 11537 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

php에서 UTF-8을 EUC-KR로 혹은 base64를 euc-kr 이런걸로 바꿔야할 경우가 종종있습니다.

iconv로 바꾸면 된다고들 하시는데 iconv는 짧은 단어만 바꿀때는 강력한데 길어지면 힘들어하더군요..

iconv("UTF-8", "EUC-KR", "동수야놀자"); //euc-kr
mb_convert_encoding("동수야 놀자","EUC-KR", "UTF-8"); //euc-kr

위에 두 함수 둘다 같은 결과를 뱉어냅니다..

그래도 좀 더 길어진 문자열이라면 상황은 다르죠... iconv는 결과를 못내줍니다.

웹메일의 본문 사용시에 mb_conver_encoding() 함수를 써봤는데 유용하더라구요..

mb_convert_encoding()함수는 변수도 " " 을 붙여합니다.

그다음 소개 해드릴건 mb_detect_encoding() 함수인데 이 함수는 현재 받아온 인자값이

어떤타입의 인코딩으로 되어있는지 보여주는겁니다.

예제) 아래 소스는 utf-8일경우 euc-kr로 바꾸는 소스입니다.

  if('utf-8' == strtolower(mb_detect_encoding($fromdecode, 'euc-kr, utf-8')))
    {
     $From = mb_convert_encoding("$fromdecode","EUC-KR", "UTF-8");
    }


  1. call undefined mysql connect 에러 발생시 해결 방안

    Date2009.06.04 ByADMINPLAY Views8433
    Read More
  2. call undefined mysql connect 와 같은 mysql 라이브러리...

    Date2009.06.04 ByADMINPLAY Views9017
    Read More
  3. Warning: main(): URL file-access is disabled in the se...

    Date2009.06.04 ByADMINPLAY Views8240
    Read More
  4. [PHP] 정규 표현식 정리

    Date2009.06.29 ByADMINPLAY Views14900
    Read More
  5. php.ini 옵션 한글설명

    Date2009.07.18 ByADMINPLAY Views9630
    Read More
  6. PHP 언어디코딩

    Date2009.07.18 ByADMINPLAY Views11537
    Read More
  7. SENDMAIL SPAMASSASSIN 관리 local.cf

    Date2009.07.18 ByADMINPLAY Views11405
    Read More
  8. Ubuntu 7.04 Server 에 Zend Optimizer 3.2.8 설치하기!

    Date2009.07.19 ByADMINPLAY Views11642
    Read More
  9. PHP - eAccelerator 설치

    Date2009.08.03 ByADMINPLAY Views15018
    Read More
  10. php컴파일에러(flex) configure: error: cannot find out...

    Date2009.08.08 ByADMINPLAY Views16112
    Read More
  11. PHPMyAdmin - blowfish_secret 해결방법

    Date2009.09.08 ByADMINPLAY Views16504
    Read More
  12. Warning: flock(): supplied argument is not a valid str...

    Date2009.09.09 ByADMINPLAY Views16768
    Read More
  13. php세션정리

    Date2009.09.19 ByADMINPLAY Views17197
    Read More
  14. Maximum execution time of 30 seconds exceeded

    Date2009.09.28 ByADMINPLAY Views17390
    Read More
  15. PHP.INI에서의 세션 관련설명

    Date2009.10.19 ByADMINPLAY Views17519
    Read More
  16. PEC HTTP Setup

    Date2009.12.31 ByADMINPLAY Views15942
    Read More
  17. pear 1.9 업그레이드 및 패치설치

    Date2009.12.31 ByADMINPLAY Views17326
    Read More
  18. Fatal error: Call to undefined function domxml_open_mem()

    Date2009.12.31 ByADMINPLAY Views17355
    Read More
  19. PHP FreeTDS 사용 (MS-SQL)

    Date2010.01.05 ByADMINPLAY Views16948
    Read More
  20. 4.1.0이상 php 버전에서 register_globals = Off 일때 기...

    Date2010.01.09 ByADMINPLAY Views15440
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234