You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by "K.WIKI" <kg...@gmail.com> on 2009/10/19 12:18:19 UTC

Special charecteres and transcode

Hi All

I have a probleme the special charactere

so I have a methode that get a string , this string can conteaint some
special caractere like 

"ϑ ϒ ϖ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ⁄ € ℑ ℘ ℜ ™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ 
∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ 
⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦"

so when I use transcose, somme of this characters changed to ????

thus is My code

I put my string in this variable strMessage

XMLString::transcode("Message",xmlChTempStr,(LENGTH_TEMPORAL_STRING - 1));
DOMElement * chmessage = m_xmlDoc->createElement(xmlChTempStr);
chText->appendChild(chmessage);


XMLString::transcode(strMessage,xmlChTemStr,(LENGTH_TEMPORAL_STRING - 1));
textNode = m_xmlDoc->createTextNode(xmlChTemStr);
chmessage ->appendChild(textNode);


any help plz

best regard
-- 
View this message in context: http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25955958.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


Re: Special charecteres and transcode

Posted by David Bertoni <db...@apache.org>.
K.WIKI wrote:
> Hi All
> 
> I have a probleme the special charactere
> 
> so I have a methode that get a string , this string can conteaint some
> special caractere like 
> 
> "ϑ ϒ ϖ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ⁄ € ℑ ℘ ℜ ™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ 
> ∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ 
> ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦"
> 
> so when I use transcose, somme of this characters changed to ????
> 
> thus is My code
> 
> I put my string in this variable strMessage
> 
> XMLString::transcode("Message",xmlChTempStr,(LENGTH_TEMPORAL_STRING - 1));
> DOMElement * chmessage = m_xmlDoc->createElement(xmlChTempStr);
> chText->appendChild(chmessage);
> 
> 
> XMLString::transcode(strMessage,xmlChTemStr,(LENGTH_TEMPORAL_STRING - 1));
> textNode = m_xmlDoc->createTextNode(xmlChTemStr);
> chmessage ->appendChild(textNode);
> 
> 
> any help plz
XMLString::transcode() converts between the local code page and UTF-16, 
which is Xerces' internal format.

It's not a good idea to depend on the local code page, since it can vary 
between systems, and your current local code page may not support all of 
the characters you're interested in. That seems to be the case here.

You should either keep all of your data in UTF-16, or use a transcoder 
for the actual encoding of your data.  If you don't know the encoding of 
your data, that's the first problem you need to solve. Once you've done 
that, you can create a transcoder for the correct encoding.

There are numerous postings in the archives that will contain more 
details that will help you.  I suggest you search the archives, do some 
research, then post again if you have more questions.

Dave

RE: Special charecteres and transcode

Posted by John Lilley <jl...@datalever.com>.
It depends on your operating system and display mechanism.

Windows GUI applications (.Net, MFC, and GDI based) will display full Unicode via UTF-16.  Xerces uses wchar_t to hold UTF-16, so the conversion to UTF-16 in Windows' WCHAR_T is a character-by-character copy.

Windows console will only display 8-bit.

Linux/Unix I think has full display via X-Windows and toolkits that use, it if you choose an appropriate font.  I don't know about Linux/Unix console, but I think that you can convert to wchar_t and use printf with "%ls" format.  Maybe someone else on mailing list can fill in Linux/Unix, that is not my expertise.

You might also look into the ICU library, which has a very large selection of transcoders.

john


-----Original Message-----
From: K.WIKI [mailto:kgoubar@gmail.com] 
Sent: Monday, October 19, 2009 8:41 AM
To: c-users@xerces.apache.org
Subject: RE: Special charecteres and transcode


Hi John 

Thanks for your response

So If I cannot use Unicode an 8-bit wath I can Used to display all
characters ??

thank you again


John Lilley wrote:
> 
> If you are transcoding from Unicode an 8-bit code page, not all characters
> are representable.
> john
> 
> -----Original Message-----
> From: K.WIKI [mailto:@gmail.com] 
> Sent: Monday, October 19, 2009 4:18 AM
> To: c-users@xerces.apache.org
> Subject: Special charecteres and transcode
> 
> 
> Hi All
> 
> I have a probleme the special charactere
> 
> so I have a methode that get a string , this string can conteaint some
> special caractere like 
> 
> "ϑ ϒ ϖ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ⁄ € ℑ ℘ ℜ ™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ 
> ∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ 
> ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦"
> 
> so when I use transcose, somme of this characters changed to ????
> 
> thus is My code
> 
> I put my string in this variable strMessage
> 
> XMLString::transcode("Message",xmlChTempStr,(LENGTH_TEMPORAL_STRING - 1));
> DOMElement * chmessage = m_xmlDoc->createElement(xmlChTempStr);
> chText->appendChild(chmessage);
> 
> 
> XMLString::transcode(strMessage,xmlChTemStr,(LENGTH_TEMPORAL_STRING - 1));
> textNode = m_xmlDoc->createTextNode(xmlChTemStr);
> chmessage ->appendChild(textNode);
> 
> 
> any help plz
> 
> best regard
> -- 
> View this message in context:
> http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25955958.html
> Sent from the Xerces - C - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25959504.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


RE: Special charecteres and transcode

Posted by "K.WIKI" <kg...@gmail.com>.
Hi John 

Thanks for your response

So If I cannot use Unicode an 8-bit wath I can Used to display all
characters ??

thank you again


John Lilley wrote:
> 
> If you are transcoding from Unicode an 8-bit code page, not all characters
> are representable.
> john
> 
> -----Original Message-----
> From: K.WIKI [mailto:@gmail.com] 
> Sent: Monday, October 19, 2009 4:18 AM
> To: c-users@xerces.apache.org
> Subject: Special charecteres and transcode
> 
> 
> Hi All
> 
> I have a probleme the special charactere
> 
> so I have a methode that get a string , this string can conteaint some
> special caractere like 
> 
> "ϑ ϒ ϖ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ⁄ € ℑ ℘ ℜ ™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ 
> ∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ 
> ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦"
> 
> so when I use transcose, somme of this characters changed to ????
> 
> thus is My code
> 
> I put my string in this variable strMessage
> 
> XMLString::transcode("Message",xmlChTempStr,(LENGTH_TEMPORAL_STRING - 1));
> DOMElement * chmessage = m_xmlDoc->createElement(xmlChTempStr);
> chText->appendChild(chmessage);
> 
> 
> XMLString::transcode(strMessage,xmlChTemStr,(LENGTH_TEMPORAL_STRING - 1));
> textNode = m_xmlDoc->createTextNode(xmlChTemStr);
> chmessage ->appendChild(textNode);
> 
> 
> any help plz
> 
> best regard
> -- 
> View this message in context:
> http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25955958.html
> Sent from the Xerces - C - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25959504.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


RE: Special charecteres and transcode

Posted by John Lilley <jl...@datalever.com>.
If you are transcoding from Unicode an 8-bit code page, not all characters are representable.
john

-----Original Message-----
From: K.WIKI [mailto:kgoubar@gmail.com] 
Sent: Monday, October 19, 2009 4:18 AM
To: c-users@xerces.apache.org
Subject: Special charecteres and transcode


Hi All

I have a probleme the special charactere

so I have a methode that get a string , this string can conteaint some
special caractere like 

"ϑ ϒ ϖ – — ‘ ’ ‚ “ ” „ † ‡ • … ‰ ′ ″ ⁄ € ℑ ℘ ℜ ™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ 
∂ ∃ ∅ ∇ ∈ ∉ ∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ 
⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦"

so when I use transcose, somme of this characters changed to ????

thus is My code

I put my string in this variable strMessage

XMLString::transcode("Message",xmlChTempStr,(LENGTH_TEMPORAL_STRING - 1));
DOMElement * chmessage = m_xmlDoc->createElement(xmlChTempStr);
chText->appendChild(chmessage);


XMLString::transcode(strMessage,xmlChTemStr,(LENGTH_TEMPORAL_STRING - 1));
textNode = m_xmlDoc->createTextNode(xmlChTemStr);
chmessage ->appendChild(textNode);


any help plz

best regard
-- 
View this message in context: http://www.nabble.com/Special-charecteres-and-transcode-tp25955958p25955958.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.