etc

preg_match for Japanese forms

郵便番号 /^[0-9]{3}-[0-9]{4}$/ if (preg_match(‘/^[0-9]{3}-[0-9]{4}$/’, $str)) { 電話番号 /^[0-9]{2,4}-[0-9]{2,4}-[0-9]{3,4}$/ if (preg_match(‘/^[0-9]{2,4}-[0-9]{2,4}-[0-9]{3,4}$/’, $str)) { Emailアドレス |^[0-9a-z_./?-]+@([0-9a-z-]+\.)+[0-9a-z-]+$| if (preg_match(‘|^[0-9a-z_./?-]+@([0-9a-z-]+\.)+[0-9a-z-]+$|’, $str)) { 全角空白のトリム /^ *(.*?) *$/u $str = preg_replace(‘/^ *(.*?) *$/u’, ‘$1’, $str); 半角+全角空白のトリム /^[\s ]*(.*?)[\s ]*$/u $str = preg_replace(‘/^[\s ]*(.*?)[\s ]*$/u’, ‘$1’, $str);

Posted in etc | Comments Off on preg_match for Japanese forms

When Chrome fails to load resource

Failed to load resource: net::ERR_CACHE_MISS Check Disable DirectWrite(Windows) at chrome://flags if the website has a multibyte character.

Posted in etc | Comments Off on When Chrome fails to load resource

utf-8 transferring

1. 리눅스에서 ICONV를 이용 하여 파일 내용을 utf8으로 변환하는 방법 그리고 파일이름을 UTF8로 변경하는 방법 url: http://www.welog.net/gbbs/bbs/board.php?bo_table=linux&wr_id=186&sca=%C6%C1&page=6 [팁] 리눅스에서 euc-kr 파일을 utf-8 파일로 변환 명령어 글쓴이 : 돗자리 리눅스에서 파일 내용에 있는 한글을 euc-kr에서 utf-8로 변환하는 방법은 다음과 같다. #iconv -c -f euc-kr -t utf-8 test.txt > test-utf8.txt 그리고 파일이름이 euc-kr인 경우에는 convmv를 이용해 파일명을 utf-8로 바꾼다. #convmv -f euc-kr -t utf-8 –notest 한글.txt 2. 리눅스에서 특정 파일들을 iconv로 변환하는 방법 — 음… 전 작동 않되더군요. url: http://www.ubuntu.or.kr/viewtopic.php?p=20579 Re: php 파일 변환에 대한 질문입니다. euc-kr 에서 utf-8 로 변환하고자 하는데.. 실험은 안 해 봤는데 이렇게 하시면 혹시 되지 않을까요? Code: find . -name ‘*.php’ -exec iconv -f euc-kr -t utf-8 […]

Posted in etc | Comments Off on utf-8 transferring

Japanese File Name

The Issue when I upload file which name is Japanese happened usually 日本語 日本語 – コピー

Posted in etc | Comments Off on Japanese File Name

Shift-JIS text to UTF-8

I searched for an answer for how to convert Japanese Shift-JIS text to UTF-8 format but couldn’t find any suitable answer so here is my proposed method. I first encountered Japanese Shift-JIS when cutting and pasting Japanese text that my wife had typed on a Windows computer. I thought it started out as UTF-8 which is best for the web but during the cut and paste in the Windows environment, it was converted to Shift-JIS format. Shift-JIS is a horrible way of encoding Japanese symbols that is only used for Japanese and there are several versions of it. But for us PC programmers, we are interested in Microsoft Code Page […]

Posted in etc | Comments Off on Shift-JIS text to UTF-8