메뉴 여닫기
개인 메뉴 토글
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

Autoit ansi 를 utf-8로 변환: 두 판 사이의 차이

데브카페
편집 요약 없음
잔글 개발노트 양식 일괄 적용
 
(같은 사용자의 중간 판 하나는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{개발노트
|요약=
|핵심=
|분야=Autoit
|작성일=2024-11-04
}}


== Autoit ansi 를 utf-8로 변환 ==
== Autoit ansi 를 utf-8로 변환 ==
32번째 줄: 38번째 줄:
FileClose($hFileOpen)
FileClose($hFileOpen)
</source>
</source>
[[category:autoit]]

2026년 11월 12일 (목) 12:45 기준 최신판

DEVCAFE NOTE
Autoit
KEY POINTS · 핵심 정리
작성일2024년 11월 4일

Autoit ansi 를 utf-8로 변환

_ConvertFileToUTF_8(@ScriptDir & "\Example.xml")

Func _ConvertFileToUTF_8($sFilePath)
    Local $iEncoding = FileGetEncoding($sFilePath)
    Local $hFileOpen = FileOpen($sFilePath, $iEncoding)
    If $hFileOpen = -1 Then
        Return SetError(1, 0, 0)
    EndIf
    Local $sData = FileRead($hFileOpen)
    FileClose($hFileOpen)

    $hFileOpen = FileOpen($sFilePath, 130)
    If $hFileOpen = -1 Then
        Return SetError(2, 0, 0)
    EndIf
    FileWrite($hFileOpen, $sData)
    Return FileClose($hFileOpen)
EndFunc   ;==>_ConvertFileToUTF_8



== 파일을 UTF-8로 열기
<source lang=autoit>
$sFilePath = @ScriptDir & '\test.txt'
$hFileOpen = FileOpen($sFilePath, 130) ; 130으로 오픈해서 기록하면 utf-8 로 기록이 가능

FileWriteLine($hFileOpen,'파일쓰기')
FileClose($hFileOpen)