| 88 | | int codePage = OS.GetACP(); |
|---|
| 89 | | int cchMultiByte = OS.WideCharToMultiByte(codePage, 0, StrToTCHARz(string), -1, null, 0, null, null); |
|---|
| | 88 | /* NOTE: CF_HTML uses UTF-8 encoding. */ |
|---|
| | 89 | int cchMultiByte = OS.WideCharToMultiByte(OS.CP_UTF8, 0, StrToTCHARz(string), -1, null, 0, null, null); |
|---|
| 133 | | auto wstrz = StrToTCHARz(codePage,buffer.toString); |
|---|
| 134 | | cchMultiByte = OS.WideCharToMultiByte(codePage, 0, wstrz, -1, null, 0, null, null); |
|---|
| | 133 | auto wstrz = StrToTCHARz(OS.CP_UTF8,buffer.toString); |
|---|
| | 134 | cchMultiByte = OS.WideCharToMultiByte(OS.CP_UTF8, 0, wstrz, -1, null, 0, null, null); |
|---|
| 171 | | int codePage = OS.GetACP(); |
|---|
| 172 | | auto cchWideChar = OS.MultiByteToWideChar (codePage, OS.MB_PRECOMPOSED, lpMultiByteStr, -1, null, 0); |
|---|
| | 171 | /* NOTE: CF_HTML uses UTF-8 encoding. |
|---|
| | 172 | * The MSDN documentation for MultiByteToWideChar states that dwFlags must be set to 0 for UTF-8. |
|---|
| | 173 | * Otherwise, the function fails with ERROR_INVALID_FLAGS. */ |
|---|
| | 174 | auto cchWideChar = OS.MultiByteToWideChar (OS.CP_UTF8, 0, lpMultiByteStr, -1, null, 0); |
|---|
| 200 | | if (fragmentEnd <= fragmentStart || fragmentEnd > lpWideCharStr.length) return null; |
|---|
| 201 | | /* TO DO: |
|---|
| 202 | | * FragmentStart and FragmentEnd are offsets in original byte stream, not |
|---|
| 203 | | * the wide char version of the byte stream. |
|---|
| 204 | | */ |
|---|
| 205 | | String s = string.substring(fragmentStart, fragmentEnd); |
|---|
| | 202 | if (fragmentEnd <= fragmentStart || fragmentEnd > OS.strlen(lpMultiByteStr)) return null; |
|---|
| | 203 | cchWideChar = OS.MultiByteToWideChar (OS.CP_UTF8, 0, lpMultiByteStr+fragmentStart, fragmentEnd - fragmentStart, lpWideCharStr.ptr, lpWideCharStr.length); |
|---|
| | 204 | if (cchWideChar is 0) return null; |
|---|
| | 205 | String s = TCHARsToStr( lpWideCharStr[ 0 .. cchWideChar ] ); |
|---|