Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPPropExchangeXMLNode read/write UTF-16 problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPPropExchangeXMLNode read/write UTF-16 problem

 Post Reply Post Reply
Author
Message Reverse Sort Order
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Topic: CXTPPropExchangeXMLNode read/write UTF-16 problem
    Posted: 24 July 2008 at 7:37am
Did you try px.LoadFromString( _bstr_t(data )) ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
hipopotamo View Drop Down
Groupie
Groupie


Joined: 01 June 2006
Location: Portugal
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote hipopotamo Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2008 at 7:24am

Hi,

 I cannot read/write to a file,   I'm using a huge configuration file to write all my presentation stuff, not only codejock stuff, but also adhoc and other libs, it would be very complicated if I had a file for each one of the commandbars and dockingmanagers from xtp.

Is there any other way I can make LoadFromString to work ?

Regards

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 July 2008 at 4:32am
Hi,
Whithout Unicode you can't use Utf-16.  Utf-8 will work for you, but in this case you have to write/read directly to file.
 
instead GetXML use SaveToFile.
 
 
also try insead
 
px.LoadFromString( data )
write
px.LoadFromString( _bstr_t(data ))
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
hipopotamo View Drop Down
Groupie
Groupie


Joined: 01 June 2006
Location: Portugal
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote hipopotamo Quote  Post ReplyReply Direct Link To This Post Posted: 23 July 2008 at 8:26am
No, i'm not using Unicode, but may be I do not need to use utf-16, i really don't know.
 
px.LoadFromString( data ) fails with this string, if i use çã instead of ca.
 
 
"><Settings CompactMode="1"> <CommandBars> <CommandBar Class="CXTPMenuBar" Type="0" BarID="1" Flags="95" Style="4194304" Title="Menu Bar" MRUWidth="32767" Closeable="0" ResourceId="132"> <Controls> <Control Class="CXTPControlPopup" Type="2" Id="1000" IconId="1000" Tag="181704656" Caption="competição" TooltipText="Popup" DescriptionText="Popup" Style="3" CommandBarId="16777216"/> </Controls> </CommandBar> <CommandBar Class="CXTPPopupBar" Type="2" Position="5" BarID="16777216" Style="4194304"/> </CommandBars> <Layout> <DockState Version="32" ScreenSize="1280, 1024" Count="1"> <BarInfo0 BarId="1" MRUWidth="32767"/> </DockState> <DockBars> <DockBar0 Count="3" Id1="1"/> </DockBars> </Layout> <Options Theme="3" Schema="32" AlwaysShowFullMenus="1" ShowFullAfterDelay="1" ToolBarScreenTips="1" ToolBarAccelTips="0" LargeIcons="0" Animation="0" SyncFloatingBars="1" ShowExpandButtonAlways="1" IconsSize="0, 0" LargeIconsSize="0, 0" IconsWithShadow="0" UseDisabledIcons="0" UseFadedIcons="1" DblClickFloat="0" ShowTextBelowIcons="0" AltDragCustomization="1" AutoHideUnusedPopups="1" PopupIconsSize="0, 0" KeyboardCuesUse="1" KeyboardCuesShow="0" Customizable="0"/> </Settings> 
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 July 2008 at 1:31am
Hi,
 
Do you compile with Unicode ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
hipopotamo View Drop Down
Groupie
Groupie


Joined: 01 June 2006
Location: Portugal
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote hipopotamo Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2008 at 7:40am
Correction!
 
It does not work for DockingManager also.
 
A string like this one "competição"( Portuguese word, same as "competition" ) invalidates all the xml.
 
 
 
 
 
Back to Top
hipopotamo View Drop Down
Groupie
Groupie


Joined: 01 June 2006
Location: Portugal
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote hipopotamo Quote  Post ReplyReply Direct Link To This Post Posted: 21 July 2008 at 12:31pm
Hi,
 
I'm trying to save the layout of the commands bars into a string using PropExchange tool, but, everytime I put a character that is not UTF-8 in the caption of the button, I'm not able to read the string again.
 
The code is something like this...
 
CXTPCommandBars *pManager;
 
<...>

 CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings"));
 px.SetEncoding( _T("UTF-16") );
 XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;

<...>
 
 pManager->DoPropExchange(&px, &param);
 

CString data = px.GetXML(true) );
 
// data string seems to be ok.
 
// to read the file
 
CXTPPropExchangeXMLNode px(true, 0, _T("Settings"));
 px.SetEncoding( _T("UTF-16") );
 XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
<...>

 if  (!px.LoadFromString( data )
 {
      fails!!!! because of the non utf8 character in the caption
}
 
 
I need to use UTF-16, but I'm not sure what I'm doing wrong.
 
Please note that I have a similar code for the DockingManager and it is working fine with non utf8 caractares.
 
 
Regards
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.