Print Thread
Plugin with Rust
#65679 05/04/24 10:41 AM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
Hello,
i'm learning Rust for myself, so i decided, as an exercice, to develop a plsql developer plugin.
I created all the necessary functions to make my dll reconize.
Add more functions, to make a basic plugin, create menu, windows ...
Most of function for my use was created.
My code is certainly no perfect, but everything works.
But i have a problem i can't resolve for now.
Every string in Rust are save in UTF-8 format, So when i pass it to PLD, accentued char are not represented correctly.

Is there a way to pass UTF-8 string to pl/sql developer?

If someone using rust to, is there a way to convert utf-8 string to iso-latin or someting else, reconized by PLD?

I have no problem with a C++ plugin.

Thanks

Last edited by fabrice; 05/05/24 12:35 PM.
Re: Plugin with Rust
fabrice #65681 05/06/24 08:37 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
Perhaps you can use the CHARMODE Plug-In setting?

Quote
C++
BOOL IDE_PlugInSetting(int PlugInID char *Setting char *Value)

Delphi
function IDE_PlugInSetting(PlugInID: Integer; Setting, Value: PAnsiChar): Bool

CHARMODE ANSI | UTF8 | UTF8BOM
Determines how PAnsiChar parameters are passed through the Plug-In interface. The UTF8BOM encoding will precede the characters with a BOM indicator when text contains Unicode.


Marco Kalter
Allround Automations
Re: Plugin with Rust
fabrice #65683 05/06/24 09:15 AM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
after some hours, i have finally found a solution to my problem.
i found a library (crate) to convert my string (textcode::iso8859_15).
I can after easily send my string to pl/sql dev.

I wil try to use the function IDE_PlugInSetting, to see if it's a better solution.
Thanks.

Last edited by fabrice; 05/06/24 09:15 AM.
Re: Plugin with Rust
fabrice #65685 05/06/24 03:24 PM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
I tried to call
bool = IDE_PlugInSetting(PLUGIN_ID, *"CHARMODE", *"UTF8") in OnCreate function.
But string with accentued char are not shown correctly.
Is it the correct way to call this function?

I added some debuglog and obtain a PlugIn Exception.
i have to look further.

OnCreate is not the good place to call IDE_PlugInSetting, RegisterCallBack was not call.

I put the call to IDE_PlugInSetting in then OnActivate function, it seem to work fine but, strings are not correct.
in debug.txt :

IDE_PlugInSetting(CHARMODE, UTF8) [Rust plsql plugin version 1.0]
IDE_PlugInSetting: OK() [Rust plsql plugin version 1.0]
IDE_DebugLog() [Rust plsql plugin version 1.0]
Plug-In: Appel IDE_PlugInSetting : OK


i tried the three options; but none works.

Last edited by fabrice; 05/07/24 07:31 AM.
Re: Plugin with Rust
fabrice #65686 05/07/24 08:59 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
In our own Plug-Ins we call this in the OnActivate function. If you set the mode to UTF8, what exactly is displayed for characters with an accent?


Marco Kalter
Allround Automations
Re: Plugin with Rust
fabrice #65687 05/07/24 09:55 AM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
instead of é, i obtain é.
It's 0xC3 0xA9
it's the same chars in my dll,

Last edited by fabrice; 05/07/24 10:08 AM.
Re: Plugin with Rust
fabrice #65688 05/08/24 08:40 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
0xC3 0xA9 is the correct UTF8 encoding for é. See also https://www.compart.com/en/unicode/U+00E9.

You may need to convert from UTF8 to a character encoding that can be displayed in your Plug-In.


Marco Kalter
Allround Automations
Re: Plugin with Rust
fabrice #65689 05/08/24 10:28 AM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
The problem is not directly in my plugin.
I send pl/sql dev something like "SUBITEM=Tables liées" for a menu item.
The menu item isn't correctly shown, bad chars are display instead of é.
i thought IDE_PlugInSetting function can make pl/sql dev could my menu item correctly.

Re: Plugin with Rust
fabrice #65691 05/09/24 08:59 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
I see. The setting may indeed not work at this level, but merely at the Oracle data level (sources and objects). You can probably pass menu item text as ANSI. For example character 0xE9 for an é.


Marco Kalter
Allround Automations
Re: Plugin with Rust
fabrice #65693 05/09/24 12:17 PM
Joined: Nov 2016
Posts: 100
F
fabrice Online Content OP
Member
OP Online Content
Member
F
Joined: Nov 2016
Posts: 100
Thanks, i found a solution for my use, not sure it's a good solution for everyone.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.088s Queries: 14 (0.022s) Memory: 2.5409 MB (Peak: 3.0425 MB) Data Comp: Off Server Time: 2024-05-18 10:51:47 UTC
Valid HTML 5 and Valid CSS