xcode +a -w help.txt help0.txt
iconv -L | sort
win_iconv -f UTF-16LE -t cp866 "UTFtext.txt" > "DOStext.txt"
win_iconv -f WINDOWS-1251 -t cp866 "WINtext.txt" > "DOStext.txt"
ipconfig /all | to1251.exe > result.txt
to1251.exe < file1.txt > result.txt
format PE console 4.0
include 'win32a.inc'
next: invoke crt_getchar
push eax
invoke GetLastError
or eax, eax
jnz exit
pop eax
call recode
invoke crt_putchar, eax
jmp next
exit:
invoke ExitProcess,0
recode:
cmp eax,080h ; rus cap 'A'
jb @5
cmp eax,0afh ; rus small 'п'
ja @1
or al,40h
@5: ret
@1:
cmp al,0e0h ; rus small 'р'
jae @4
mov al,20h ; pseudoghaphic chrs 0xb0-0xdf -> <space>
ret
@4: cmp al, 0efh ; rus small 'я'
ja @3
add al,10h
ret
@3: and ax, 0fh
mov ebx, xlt
xlatb
@2:
ret
xlt db 0a8h, 0b8h, 0aah, 0bah, 0afh, 0bfh, 0a1h, 0a2h, 0b0h, 95h, 0b7h,20h,0b0h,0a4h,20h,20h
; import data in the same section
data import
library kernel32,'KERNEL32.DLL',\
msvcrt,'MSVCRT.DLL'
import kernel32,\
ExitProcess,'ExitProcess',\
GetLastError,'GetLastError'
import msvcrt,\
crt_getchar,'getchar',\
crt_putchar, 'putchar'
end data
cmd /U /C echo Всё ГУД>"myfile.txt"
cmd /U /C type "myfile_866.txt" > "myfile_Unicode.txt"
Batch.cmd infile outfile src_codepage
@echo off
:: преобразование текстового файла в unicode (utf-16 LE)
:: вызов: to_uni infile outfile codepage
:: BAT-файл должен быть сохранен в кодировке WIN-1251
SetLocal EnableExtensions
For /f "tokens=2 delims=:" %%G in ('CHCP') do Set _codepage=%%G
chcp 1251 >nul
CMD.EXE /D /A /C (set /p=яю)<NUL > "%~2"
CHCP %~3 >NUL
CMD.EXE /D /U /C TYPE "%~1" >> "%~2"
CHCP %_codepage% >NUL
@echo off
:: преобразование текстового файла в unicode (utf-16 LE)
:: вызов: to_uni infile outfile codepage
:: BAT-файл должен быть сохранен в кодировке OEM-866
SetLocal EnableExtensions
For /f "tokens=2 delims=:" %%G in ('CHCP') do Set _codepage=%%G
chcp 866 >nul
for /F %%? in ('echo яю') do chcp 1251 >nul& CMD.EXE /D /A /C (set /p=яю)<NUL > "%~2"
CHCP %~3 >NUL
CMD.EXE /D /U /C TYPE "%~1" >> "%~2"
CHCP %_codepage% >NUL
@echo off
SetLocal
::Файл с кодировкой OEM-866
set FileIn=text.txt
::Результат, куда записывать WIN-1251
set FileOut=text.txt
chcp 866> nul
for /f "delims=" %%a in (%FileIn%) do (
if not defined cpReady (
chcp 1251> nul
set CpReady=True
)
call :convert "%%a" 2>NUL
)
chcp 866> nul
goto :eof
:convert
echo.%~1>>"%FileOut%"
cscript.exe //nologo Recode.vbs "cp866" "windows-1251" "имя_файла"
cscript.exe //nologo Recode.vbs "windows-1251" "cp866" "имя_файла"
On Error Resume Next
FullName = WScript.Arguments(2)
With CreateObject("ADODB.Stream")
.Type = 2
.Charset = WScript.Arguments(0)
.Open
.LoadFromFile FullName
Text = .ReadText()
.Close
.Charset = WScript.Arguments(1)
.Open
.WriteText (Text)
.SaveToFile FullName, 2
.Close
End with
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?