Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling special characters from C++ #303

Open
OCIntel opened this issue Apr 13, 2022 · 2 comments
Open

Handling special characters from C++ #303

OCIntel opened this issue Apr 13, 2022 · 2 comments
Assignees

Comments

@OCIntel
Copy link

OCIntel commented Apr 13, 2022

Ocilib version: 4.7.4
Charset mode: ANSI
Platform: Windows

Hello Vincent,

I would like to know how to indicate at the environment initialization that we want to use a specific charset?
By consulting a similar issue (#45 (comment)), I found a temporary working solution which implies to modify an environment variable, like this:

_putenv_s("NLS_LANG", "American_America.UTF8");
Environment::Initialize(Environment::Default | Environment::Threaded);
_putenv_s("NLS_LANG", "");

This solution works but is not viable for my project.

I also saw that you can specify the charset for a bind with SetCharsetForm, like this:

stmt->Bind(":1", val, INOUT_STRING_SIZE, BindInfo::In);
stmt->GetBind(":1").SetCharsetForm(CharsetFormValues::CharsetFormNational);

Apart from the fact that this option is only available for binding queries, it produces an error at compile time, which suggests that I am using the method incorrectly:

error LNK2019: unresolved external symbol OCI_BindSetCharsetForm referenced in function "public: void __cdecl ocilib::BindInfo::SetCharsetForm(class ocilib::core::Enum)" (?SetCharsetForm@BindInfo@ocilib@@QEAAXV?$Enum@W4CharsetFormValues@ocilib@@@core@2@@z)

Do you have any idea how to solve this problem?

Thanks for your help!

@vrogier
Copy link
Owner

vrogier commented Sep 7, 2022

Hi,

Sorry for such a delayed response.

Regarding the linking issue that a bug in the C++ API that will be fixed in branch 4.7.5.
I will create a separate issue for it.

About specifying the charset, it can only be done currently in OCILIB using the nls_lang parameter and/or env variable .

I don't get your issue about "temporary setting" the variable.
Setting the variable can be done only at current process level.

Regards,

Vincent

@vrogier
Copy link
Owner

vrogier commented Oct 4, 2022

Hi,

Any news ?

btw, I created an issue (#314) and committed a fix for the visibility of OCI_BindSetCharsetForm()

regards,

Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants