PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   疑難雜症區 (https://www.pcdvd.com.tw/forumdisplay.php?f=34)
-   -   Notepad 存utf8的解決方案 (https://www.pcdvd.com.tw/showthread.php?t=1113862)

redhouseee 2016-10-16 05:20 AM

Notepad 存utf8的解決方案
 
Notepad 存utf8時會在檔案前面加3個 byte的 bom

用android studio 寫java時很困擾

的破解

系統 windows 10 64 bit


takeown /f notepad.exe
icacls notepad.exe /grant everyone:F

32 bit
C:\Windows\sysWOW64\notepad.exe
207,872 Bytes
6660 : 00 00 83 E8 01 0F 84 9E-00 00 00 83 E8 01 75 1E
6660 : — — — — — — — — — — — — — — EB —
64 bit
C:\Windows\system32\notepad.exe
215,040 Bytes
3FA0 : 83 F9 01 75 2B
3FA0 : — — — EB — 

asccpu 2016-10-16 10:10 AM

UNICODE格式的檔頭通常是2BYTES(UTF-32則是4BYTES) : FF FE。
如果你要不帶有BOM標記的,唯一方法只能存"生的UTF-16",讀取程式就直接以UTF-16方式(也就是每次以2BYTES取字)讀檔處理了。

生的UTF-16,可以以下BAT命令創出。
CMD /U /C DIR /S D:*.* > %DATE%-HD_D_LIST.TXT

twu2 2016-10-16 10:40 AM

改執行檔不是好方法... 不小心更新到就要再改一次.

直接找個能自行決定要不要產生 BOM 的 editor 比較快, 然後加個 registry 直接取代系統的 notepad.exe
代碼:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="\"C:\\Editor\\notepad.exe\""


只要系統要執行 notepad.exe 就會執行所指定的執行檔.

crisliu2004 2016-10-16 11:03 AM

請愛用 notepad++

開大檔速度也是首屈一指的


所有的時間均為GMT +8。 現在的時間是06:39 PM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。