![]() |
CXTPPropExchangeXMLNode read/write UTF-16 problem |
Post Reply ![]() |
Author | |
hipopotamo ![]() Groupie ![]() Joined: 01 June 2006 Location: Portugal Status: Offline Points: 34 |
![]() ![]() ![]() ![]() ![]() 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, ¶m);
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
|
|
![]() |
|
hipopotamo ![]() Groupie ![]() Joined: 01 June 2006 Location: Portugal Status: Offline Points: 34 |
![]() ![]() ![]() ![]() ![]() |
Correction!
It does not work for DockingManager also.
A string like this one "competição"( Portuguese word, same as "competition" ) invalidates all the xml.
|
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Do you compile with Unicode ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
hipopotamo ![]() Groupie ![]() Joined: 01 June 2006 Location: Portugal Status: Offline Points: 34 |
![]() ![]() ![]() ![]() ![]() |
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> |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
hipopotamo ![]() Groupie ![]() Joined: 01 June 2006 Location: Portugal Status: Offline Points: 34 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Did you try px.LoadFromString( _bstr_t(data )) ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |