flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > [SOLVED] SQLite + ListView [chars encoding problem] | 
  
| Author | 
  | 
              
| 
                  
                   ctl3d32 21 Jun 2017, 18:16 
                  Hey there!
 
        Need some help fixing this code snippet, for it is displaying wrong chars in listview. Thanks, ctl3d32 
 Last edited by ctl3d32 on 22 Jun 2017, 00:28; edited 1 time in total  | 
              |||||||||||
                  
  | 
              
| 
                  
                   ctl3d32 21 Jun 2017, 21:36 
                  Thanks revolution. Gonna try that. 
                 | 
              |||
                  
  | 
              
| 
                  
                   ctl3d32 22 Jun 2017, 00:20 
                  revolution wrote: From what I can tell your basic problem is to convert from the UTF8 encoding stored in the DB into a 'wide' UCS2 encoding for Windows. Actually, windows has a UTF8-to-wide and a wide-to-Multibyte converter. I used them and i got it working. No need to use SendMessageW. Changes in the code are shown below: Code: ;+++++++++++++++++++++++++++++++++++++++++++++++++ invoke RtlZeroMemory,szBuffer,MAX_PATH invoke RtlZeroMemory,szBuffer2,MAX_PATH mov dword[lvi + LV_ITEM.iItem],9999d cinvoke sqlite3_column_bytes,[hStmt],0 mov [ibytes],eax cinvoke sqlite3_column_text,[hStmt],0 invoke MultiByteToWideChar,CP_UTF8,0,eax,[ibytes],szBuffer,MAX_PATH invoke WideCharToMultiByte,CP_ACP,0,szBuffer,[ibytes],szBuffer2,MAX_PATH,NULL,NULL lea eax,[szBuffer2] mov [lvi + LV_ITEM.pszText],eax invoke SendMessage,[hListView],LVM_INSERTITEM,0,lvi jmp @b ;+++++++++++++++++++++++++++++++++++++++++++++++++ Thanks 
  | 
              |||||||||||
                  
  | 
              
| 
                  
                   revolution 22 Jun 2017, 07:57 
                  ctl3d32 wrote: Actually, windows has a UTF8-to-wide and a wide-to-Multibyte converter. I used them and i got it working. ctl3d32 wrote: No need to use SendMessageW.  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.