Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ReplaceSel(…) does not work with DBCS

ReplaceSel(…) does not work with DBCS

Scheduled Pinned Locked Moved C / C++ / MFC
databasetestingbeta-testingtoolshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John R Shaw
    wrote on last edited by
    #1

    I am trying to display Japanese characters in a CRichEditView by setting the text using GetRichEditCtrl().ReplaceSel(…), but it does not work. The correct font is selected, so I know that is not the problem. DBCS Example: 1) I run the Rich Text (RT) application, written in VC6. 2) Open ‘Accessories->System Tools->Character Map’, select same Font and Language as RT app., select full-width character ‘Z’ and paste it to RT app. 3) No problem! 4) Inside the RT app., programmatically select the DB text, and get a copy of it using GetRichEditCtrl().GetSelText(). 5) Replace the selected text with the copy you just made using GetRichEditCtrl().ReplaceSel(…). 6) Problem: Instead of displaying a DB character it displays the ‘lead’ and ‘trail’ bytes as individual characters. The full-width ‘Z’ is stored as “\x82\x79”, but if you pass that string to ReplaceSel(…), it will display “,y” instead of “Z”. I have verified that the correct font is specified for the text being displayed (SHIFTJIS_CHARSET, "MS PMincho"), but it is not showing correctly, as stated above. Do you have any ideas why this happens?

    INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups