• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Special Characters Not Translating

Explorer ,
Aug 25, 2021 Aug 25, 2021

Copy link to clipboard

Copied


Hi,
Using coldfusion 16 and backend sqlserver. Have a product table whose name field is of data type "nvarchar(250)". Have data to insert which contain special characters like Apostrophe (‘), Ampersand (&), Trademark (™), Circle R (®), Copyright – Circle C (©)
Now, it's storing in DB these characters like '?'.
Is it possible to store the characters as such in DB?
Please advise

Views

401

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2021 Aug 25, 2021

Copy link to clipboard

Copied

I want to cancel the subscription for this

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2021 Aug 25, 2021

Copy link to clipboard

Copied

2021-08-25_11-29-17 how to unfollow ColdFusion in Adobe Support Community.png

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2021 Aug 25, 2021

Copy link to clipboard

Copied

If you're seeing those characters, it could be because you're not saving them as Unicode, or because you're not retrieving them as Unicode. Try each of those things separately. Look at SQL Server directly using SQL Server Management Console or whatever it's called nowadays, and run a query to fetch them. If they're still showing up as question marks, that indicates you're not saving them as Unicode. Otherwise, you're retrieving and/or displaying them in a way that doesn't support Unicode.

 

If you're not saving them as Unicode, check your SQL Server data source to make sure that the Unicode box is checked under "Advanced Settings" if I recall correctly. That's the most likely problem, I think. See how that works and let us know.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 26, 2021 Aug 26, 2021

Copy link to clipboard

Copied

Thanks for the guidance.
While trying directly from SQL Server Management Console window, the special characters are saved to table
column correctly.But while trying to insert using cf code, ie reading the special character text from a csv file
and importing to sql table,it is not getting saved properly.


Tried with above mentioned unicode settings from cf admin datasource advance settings area, restarted both cf service and system,still saving incorrectly.

Please advise

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 26, 2021 Aug 26, 2021

Copy link to clipboard

Copied

You also need to set the character encoding to UTF-8 so the characters coming in do not get stripped.

 

In the application.cfc add 

  SetEncoding("form","utf-8");
  SetEncoding("url","utf-8");
 
Also on your page display include the following in the HTML header
  <meta charset="utf-8">
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2021 Aug 29, 2021

Copy link to clipboard

Copied

LATEST

Ensure that your ColdFusion application uses UTF-8 encoding. One way to do so is as follows:

  1. Open the ColdFusion Administrator for the particular ColdFusion instance;
  2. Navigate to the page Server Settings > Java and JVM;
  3. Inspect the content of the field JVM Arguments. Does it include the setting -Dfile.encoding=UTF-8 ?
    If so, then the application uses UTF-8 encoding, and there's no need to proceed any further. We have to look for the cause of the problem elsewhere.
    If not, then you have to include UTF-8 encoding in your Java settings.
  4. To include UTF-8 encoding, place your mouse cursor at the end of the text in the JVM Arguments field. Press space-bar of your keyboard to create a space. Type -Dfile.encoding=UTF-8 and press the button to Submit Changes.
  5. Restart the ColdFusion instance. 

 

Does that solve the problem?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation