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 6389409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:23:59+00:00 2026-05-25T03:23:59+00:00

The intention of the code is printing unicode as japanese characters to a file

  • 0

The intention of the code is printing unicode as japanese characters to a file

   String s = "\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093";
   var Bytes = Encoding.Unicode.GetBytes(s);      
   string  key = Encoding.UTF8.GetString(Encoding.Convert(Encoding.Unicode, Encoding.UTF8, Bytes));

Key is I want to print to file but has the value \u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093 Any ideas whats wrong?

  • 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-05-25T03:24:00+00:00Added an answer on May 25, 2026 at 3:24 am

    What’s wrong is that a string (key) has no notion of the bytes used to store it. In this case, your string is:

    String:

    アップロードするファイルが指定されていません
    

    this is exactly what

    "\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093" 
    

    means. The expression '\u30a3' looks like 2 Unicode bytes, but it actually just means the character 'ア'.

    if you save to a UTF-8 file, the bytes written will be:

    UTF-8 bytes

    File.WriteAllText("temp.txt", "アップロードするファイルが指定されていません", Encoding.UTF8);
    

    The contents will be (in bytes)

     E3 82 A2 E3 83 83 E3 83 97 E3 83 AD E3 83 BC E3 83 89 E3 81 99 E3 82 8B E3 83 
     95 E3 82 A1 E3 82 A4 E3 83 AB E3 81 8C E6 8C 87 E5 AE 9A E3 81 95 E3 82 8C E3 
     81 A6 E3 81 84 E3 81 BE E3 81 9B E3 82 93
    

    UTF-16 bytes

    File.WriteAllText("temp.txt", "アップロードするファイルが指定されていません", Encoding.Unicode);
    

    The contents will be (in bytes)

     A2 30 C3 30 D7 30 ED 30 FC 30 C9 30 59 30 8B 30 D5 30 A1 30 A4 30 EB 30 4C 30 
     07 63 9A 5B 55 30 8C 30 66 30 44 30 7E 30 5B 30 93 30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My intention is to write a byte[] to a file. Code snippet is below:
This is the code section from inno setup.My intention is to make two Checkbox
Consider this bit of obfuscated code. The intention is to create a new object
Insertion of a file's tag, thus executing the file's code. Removal of the file's
In the below code snippet, the intention is to take value for name from
My intention is to read a raw resource and convert it to Java code
In my code on the line //some describtion text I can make Intention Replace
I have the line of code below in my contact form with the intention
Intention Using the following code, I managed to load some applications in my windows
I have no intention of using this in real code. I promise. Does the

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.