add example to readme and sample file

This commit is contained in:
Tr0n 2024-04-06 00:25:51 +02:00
parent e8c1c0eb37
commit 183a7b1908
No known key found for this signature in database
2 changed files with 41 additions and 2 deletions

View File

@ -20,6 +20,45 @@ find . -name '*.cpp' -exec iconv -f EUC-KR -t UTF-8//TRANSLIT -o {}_u {} \; -exe
Repeat for the desired file extensions.
## Example result
Original File Content (read as UTF-8)
```cpp
// this string literal should be converted
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<22>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ⱦ<EFBFBD><C8BE><EFBFBD>"));
// this line should stay untouched
DWORD dwOppList[8]; // <20>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ⱦ<EFBFBD><C8BE><EFBFBD>
```
Original File Content (read as EUC-KR and converted to UTF-8)
```cpp
// this string literal should be converted
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이거 지금은 안쓴데"));
// this line should stay untouched
DWORD dwOppList[8]; // 이거 지금은 안쓴데
```
After running this script (read as UTF-8)
```cpp
// this string literal should be converted
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC\xB0\xC5 \xC1\xF6\xB1\xDD\xC0\xBA \xBE\xC8\xBE\xB4\xB5\xA5"));
// this line should stay untouched
DWORD dwOppList[8]; // <20>̰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ⱦ<EFBFBD><C8BE><EFBFBD>
```
After running `iconv` on the script output (read as UTF-8)
```cpp
// this string literal should be converted
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC\xB0\xC5 \xC1\xF6\xB1\xDD\xC0\xBA \xBE\xC8\xBE\xB4\xB5\xA5"));
// this line should stay untouched
DWORD dwOppList[8]; // 이거 지금은 안쓴데
```
## Usage
To install dependencies:

View File

@ -1,4 +1,4 @@
// this string literal should be converted
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>ִ<EFBFBD> <20><>Ƽ<EFBFBD><C6BC> 8<><38> <20>̹Ƿ<CCB9>.."));
chA->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이거 지금은 안쓴데"));
// this line should stay untouched
DWORD dwOppList[8]; // <EFBFBD>ִ<EFBFBD> <20><>Ƽ<EFBFBD><C6BC> 8<><38> <20>̹Ƿ<CCB9>..
DWORD dwOppList[8]; // 이거 지금은 안쓴데