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. Convert LPWSTR to LPSTR

Convert LPWSTR to LPSTR

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 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.
  • A Offline
    A Offline
    ajitatif angajetor
    wrote on last edited by
    #1

    Hi everyone, I need to convert a unicode LPWSTR to multi-byte LPSTR.wcstombs_s doesn't do good,because it replaces non-english characters to their english likes (like ş->s and ı>i). WideCharToMultiByte function seems to do this right,but the double-byte characters in the converted LPSTR are interpreted as if they are two single-byte characters. to be more specific,I use MAPI dll to send an e-mail.MAPI dll expects all strings to be LPSTR which maps to int.but i want to use non-english characters in e-mail's body/subject/attached files' names,and couldn't find a solution yet.it's all good when strings are in english,because all unicode characters map to a signed char then.but when i get a non-english character,"problem".LPSTR seems to interpret all characters to be single-byte. any suggestions?

    J 1 Reply Last reply
    0
    • A ajitatif angajetor

      Hi everyone, I need to convert a unicode LPWSTR to multi-byte LPSTR.wcstombs_s doesn't do good,because it replaces non-english characters to their english likes (like ş->s and ı>i). WideCharToMultiByte function seems to do this right,but the double-byte characters in the converted LPSTR are interpreted as if they are two single-byte characters. to be more specific,I use MAPI dll to send an e-mail.MAPI dll expects all strings to be LPSTR which maps to int.but i want to use non-english characters in e-mail's body/subject/attached files' names,and couldn't find a solution yet.it's all good when strings are in english,because all unicode characters map to a signed char then.but when i get a non-english character,"problem".LPSTR seems to interpret all characters to be single-byte. any suggestions?

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      ajitatif angajetor wrote:

      MAPI dll expects all strings to be LPSTR which maps to int.but i want to use non-english characters in e-mail's body/subject/attached files' names,and couldn't find a solution yet

      What you need is encoding. There are several types of encoding around, some standards, some more habits grown out of prolonged use. Read about MIME.


      "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

      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