Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:18:46+00:00 2026-06-06T04:18:46+00:00

I want to decode Unicode strings to UTF-8 when inserting in a table. Here’s

  • 0

I want to decode Unicode strings to UTF-8 when inserting in a table. Here’s what I have:

('\u0645\u064e\u062b\u0652\u0646\u064e\u0649 \u00a0\u062c \u0645\u064e\u062b\u064e\u0627\u0646\u064d')

So I want these values to be converted to UTF-8, for example:

INSERT INTO `nouns`(`NOUNID`, `WORDID`, `SINGULAR`, `PLURAL`) VALUES (781, 3188, '\u0646\u064e\u062c\u0652\u0645', ('\u0646\u064e\u062c\u0652\u0645'))

I am migrating my h2 database to MySQL, so I got this when scripting my h2 db:

INSERT INTO PUBLIC.NOUNS(NOUNID, WORDID, SINGULAR, PLURAL) VALUES
  (1, 5, STRINGDECODE('\u0623\u0628\u0651 '), STRINGDECODE
  ('\u0623\u0624\u064f\u0628\u0651')),
  (2, 9, STRINGDECODE('\u0623\u064e\u0628\u0627\u0628'), ''),

basicly thees \u0623\u0632\u0651 are arabic charchters in unicode representation and I want to convert them in real arabic characters, to be stored like that in database.
I was trying convert function, but because I am new to mysql I couldn’t achive this:

SELECT CONVERT(_ucs2'\u0623' USING utf8);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:18:48+00:00Added an answer on June 6, 2026 at 4:18 am

    There is no built-in function to decode unicode escapes in MySQL, but you can create one; see below:

    Note that the backslash is an escape character in MySQL, so you’ll need to double them when you write SQL: '\\u0623\\u064e\\u0628\\u0627\\u0628'

    DELIMITER //
    
    CREATE FUNCTION STRINGDECODE(str TEXT CHARSET utf8)
    RETURNS text CHARSET utf8 DETERMINISTIC
    BEGIN
    declare pos int;
    declare escape char(6) charset utf8;
    declare unescape char(3) charset utf8;
    set pos = locate('\\u', str);
    while pos > 0 do
        set escape = substring(str, pos, 6);
        set unescape = char(conv(substring(escape,3),16,10) using ucs2);
        set str = replace(str, escape, unescape);
        set pos = locate('\\u', str, pos+1);
    end while;
    return str;
    END//
    
    DELIMITER ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a unicode string like '%C3%A7%C3%B6asd+fjkls%25asd' and I want to decode this string.
Here we have a scenario to encode file name and want to decode it
I have a string and I want to decode into json. The string was
I have a big php code that i want to encode and decode it
I want to decode my string. I have used parsing and get a string
I have several encoded strings and I need to decode them, my guess is
I have an NSstring that is encoded with UTF8. I want to decode it.
I want to send email messages that have arbitrary unicode bodies in a Python
I have a object which contains unicode data and I want to use that
Here's my problem, I have a variable wrongly encoded that I want to fix.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.