Click here to Skip to main content
15,881,715 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionutf to ascii conversion Pin
khushboo gupta5-Apr-13 23:12
khushboo gupta5-Apr-13 23:12 
AnswerRe: utf to ascii conversion Pin
Richard MacCutchan6-Apr-13 1:47
mveRichard MacCutchan6-Apr-13 1:47 
GeneralRe: utf to ascii conversion Pin
khushboo gupta6-Apr-13 2:39
khushboo gupta6-Apr-13 2:39 
GeneralRe: utf to ascii conversion Pin
Richard MacCutchan6-Apr-13 3:28
mveRichard MacCutchan6-Apr-13 3:28 
GeneralRe: utf to ascii conversion Pin
khushboo gupta7-Apr-13 18:30
khushboo gupta7-Apr-13 18:30 
GeneralRe: utf to ascii conversion Pin
khushboo gupta9-Apr-13 2:35
khushboo gupta9-Apr-13 2:35 
GeneralRe: utf to ascii conversion Pin
Richard MacCutchan9-Apr-13 5:03
mveRichard MacCutchan9-Apr-13 5:03 
AnswerRe: utf to ascii conversion Pin
MicroVirus6-Apr-13 6:52
MicroVirus6-Apr-13 6:52 
You should be aware that all solutions involving wcstombs and related depend on the locale and the typical encoding might not be what you call 'ascii'.
Actually, what is called ASCII does not contain any Arabic characters whatsoever. Probably, you are referring to a specific codepage that uses ASCII + some Arabic characters?
In that case, it's probably a good idea to set the proper locale before conversion (see Richard MacCutchans post for info), so you get the correct codepage and not, as you probably get with the code given so far, UTF-8 encoding, which means that the text file will contain multiple bytes per character.

For instance, see http://stackoverflow.com/questions/2190190/wcstombs-character-encoding[^]. Probably something like setlocale( LC_ALL, "ar.1256" ); will do what you need; it should set the codepage to windows 1256 (which is used for arabic) and use the (generic) Arabic locale.

Locales and encoding are a quite complicated issue, so you should be careful and precise when using them. Also, by C++ definition the locale employ system-dependent strings for locale, so if should cater to the platform you are coding for.
GeneralRe: utf to ascii conversion Pin
khushboo gupta7-Apr-13 18:33
khushboo gupta7-Apr-13 18:33 
QuestionT13 Secure Erase Pin
RomTibi5-Apr-13 11:46
RomTibi5-Apr-13 11:46 
AnswerRe: T13 Secure Erase Pin
dusty_dex5-Apr-13 21:08
dusty_dex5-Apr-13 21:08 
GeneralRe: T13 Secure Erase Pin
RomTibi6-Apr-13 2:18
RomTibi6-Apr-13 2:18 
GeneralRe: T13 Secure Erase Pin
dusty_dex6-Apr-13 7:53
dusty_dex6-Apr-13 7:53 
GeneralRe: T13 Secure Erase Pin
RomTibi6-Apr-13 8:39
RomTibi6-Apr-13 8:39 
AnswerRe: T13 Secure Erase Pin
Randor 6-Apr-13 17:56
professional Randor 6-Apr-13 17:56 
GeneralRe: T13 Secure Erase Pin
RomTibi7-Apr-13 6:34
RomTibi7-Apr-13 6:34 
GeneralRe: T13 Secure Erase Pin
Joe Marley9-Apr-13 11:32
Joe Marley9-Apr-13 11:32 
QuestionScreen Lock for MFC App Pin
Donguy19765-Apr-13 11:31
Donguy19765-Apr-13 11:31 
AnswerRe: Screen Lock for MFC App Pin
André Kraak5-Apr-13 12:29
André Kraak5-Apr-13 12:29 
AnswerRe: Screen Lock for MFC App Pin
Randor 6-Apr-13 18:18
professional Randor 6-Apr-13 18:18 
QuestionPlaySound method doesn't function in a Win7 Srvany Service Pin
rhfritz15-Apr-13 5:48
rhfritz15-Apr-13 5:48 
AnswerRe: PlaySound method doesn't function in a Win7 Srvany Service Pin
MicroVirus10-Apr-13 0:23
MicroVirus10-Apr-13 0:23 
QuestionOnFileOpen crashing Pin
_Flaviu4-Apr-13 22:31
_Flaviu4-Apr-13 22:31 
AnswerRe: OnFileOpen crashing Pin
CPallini4-Apr-13 22:40
mveCPallini4-Apr-13 22:40 
AnswerRe: OnFileOpen crashing Pin
Jochen Arndt4-Apr-13 22:42
professionalJochen Arndt4-Apr-13 22:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.