Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to change NAV Odata WS encoding

Posted on by Microsoft Employee

Hello,

I am calling a Navision Odata WS adding "?$format=json" to recive the response like a JSON.

The response:

{
"odata.metadata": "http://***********:10048/******/OData/$metadata#Socios/@Element",
"N_x00BA_": "AD001",
"Situaci\u00f3n_como_Socio": "Baja",
"N_x00BA__de_matr\u00edcula": "146",
"Nombre": "JESUS",
"Apellido_1": "ACEBES",
"Apellido_2": "ENJUTO",
"Tel\u00e9fono_1": "",
"Tel\u00e9fono_2": "",
"e_mail_trabajo": "*****@*****.com",
"C\u00f3d_provincia": "28",
"e_mail_particular": "",
"ETag": "28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;"
}

As you can see, special characters arent shown correctly.

"N_x00BA_" instead of "Nº"

or
"Tel\u00e9fono_1" instead of "Teléfono_1"

¿What config do i need in NAV to show special characters correctly?

¿Do i need NAV to add UTF-8 encoding header in the JSON? ¿How?

Thx you very much.


*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to change NAV Odata WS encoding

    Hello Marcell,

    Thx for your response.

    I am using IE and Chrome with same results.

    The field: Text 20.

    I am not the navision admin so i can only see the table desing.

    If i call the service asking for xml format, then the field is shown correctly. Its only when i use the json format.

    <?xml version="1.0" encoding="utf-8"?>

    <feed xml:base="http://............./......../OData/" 
    xmlns="http://www.w3.org/2005/Atom"
    xmlns:d="schemas.microsoft.com/.../dataservices"
    xmlns:m="schemas.microsoft.com/.../metadata">

    <d:Teléfono_1>123456789</d:Teléfono_1>


    Thx you.
  • Marcellus Profile Picture
    Marcellus 2,735 on at
    RE: How to change NAV Odata WS encoding

    Hi JorgeCC,

    What tool are you using?

    I tried to replicate your problem. Added a field called "Teléfono_1" in the customer table and added it to the customer card page. Then I called the odata web service like this in IE: 

    http://......./DynamicsNAV100/OData/Company('CRONUS%20UK%20Ltd.')/Customer?$format=json

    and I received this:

    {
    "No": "01121212",
     "Teléfono_1": "",          
    }

    Can you check what the field looks like in the table object in SQL?

    telefono.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans