Skip to main content
Known Participant
June 25, 2008
Question

How covert AIUnicodeString to ADMUnicode ?

  • June 25, 2008
  • 2 replies
  • 1096 views
how covert AIUnicodeString to ADMUnicode or covert ADMUnicode to AIUnicodeString??

I want to show file path on ADMItem, but the file path is AIUnicodeString, and SetTextW function need ADMUnicode, how can I do it?

Thanks!

hanyang.
This topic has been closed for replies.

2 replies

jdyyzAuthor
Known Participant
June 26, 2008
Thanks A. Patterson!

I want to my plugin support Asia language, but Asia character can't correctly display on ADMItem by using ADMUnicode, and now I don't know what the problem is.

Here's the code:

sAAIUser->GetDirectoryDialog( title, forceLocalFileView, Directory_Path );

if ( !Directory_Path.IsEmpty() )
{
const ADMUnicode* DisplayFilePath = Directory_Path.GetFullPath().as_ASUnicode().c_str();
sADMItem->SetTextW(sADMDialog->GetItem(dialog, kDestinationPath), DisplayFilePath );
}
Participating Frequently
October 18, 2011

I was happy to find this bit of advice, but I am still having trouble with ADMUnicode, especially on Mac.

On Windows, I ran into the issue where a string that was not using unicode characters would result in an empty ADMUnicode string.

Now on Mac, the strings are not empty when I step through code, but there is no text displayed in my dialogs when I use SetTextW. It will sometimes show up after I set a breakpoint in XCode and return to AI, but the next update will clear it.

Any ideas about what is going on here? The functions work in Windows as long as I make sure the string is not empty.

A. Patterson
Inspiring
June 25, 2008
I assume you mean ai::UnicodeString, not AIUnicodeString -- the name of the header in which the former is found. I'll proceed on that assumption.<br /><br />The method you want is ai::UnicodeString::as_ASUnicode(). This will give you a basic_string<ASUnicode> as a result. You should be able to use this to get a ASUnicode* result using c_str(). <br /><br />The important thing to note is that ASUnicode & ADMUnicode are the same type; one is a typedef of the other.<br /><br />I'd provide code but we actually use a third party library that handles our strings, so I actually convert from ai::UnicodeString to our third party string, and from that to ADMUnicode when the time comes. It's not hard though, once you have the result of as_ASUnicode().