windows에서 boost 설치시 949 경고나는 hpp 파일을 utf8으로 수정

semmal의 이미지

vc2005 컴파일시 표시할 수 없는 문자 관련 경고

windows에 boost를 설치하려고 보니 인코딩(cp949)이 맞지 않아서 경고가 나는군요. 자루라는 분이 과거에 올려놓은 블로그를 참조해서 python3에서 돌아가도록 아주 약간만 변경해봤습니다.

import os
import stat
 
def FindFilesByExt(ext, path):
    if path[-1] != os.sep:
        path += os.sep
 
    ext = ext.lower()
 
    retList = []
    for name in os.listdir(path):
        if stat.S_ISDIR(os.stat(path + name).st_mode):
            retList += FindFilesByExt(ext, path + name)
        else:
            if name[-len(ext):].lower() == ext:
                retList.append(path + name)
 
    return retList
 
for name in FindFilesByExt(".hpp", "."):
    print(name)
    src = open(name,encoding="latin1").read()
    open(name,"w",encoding="utf8").write(src)