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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:45:50+00:00 2026-06-16T01:45:50+00:00

Possible Duplicate: Accented characters not correctly imported with BULK INSERT A .net program running

  • 0

Possible Duplicate:
Accented characters not correctly imported with BULK INSERT

A .net program running in my system provides me with a csv file. I would like to know the encoding of that file.

The csv file has é,ä,å,æ characters but is shown as �(UTF8-with BOM). Is there any possibility that I can bet back these characters to its original or its English like characters.

The csv file is created by a .net program running in the same machine under same user but after the creation of the file I cannot see the original characters.

Related question.

sample data (UTF8-Without BOM) from csv file. 

Pok�mon Black Version
TGC � Nintendo
on H�tel de R�ve  
La Reine Masqu�e et la Tour des Miroirs 
  • 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-16T01:45:54+00:00Added an answer on June 16, 2026 at 1:45 am

    If you see �, when you decode the file as UTF-8, but you see �, when you decode it as Windows-1252, then the file literally contains �. I.E. It literally contains the bytes 0xEF 0xBF 0xBD (UTF-8 for �) . Therefore the data is unrecoverable at this point.

    This happens when physical encoding of some byte stream does not match the encoding used to decode it. So for instance, the physical encoding is Windows-1252, then a program decodes it to internal string using UTF-8 with replacement fallback. Now, the string internally contains �, but it is not inspected and is written to a file as UTF-8, and the resulting file is what you have.


    To avoid the original screw up, it is a good idea to use exception fallback instead of replacement fallback when decoding files, for example:

    Encoding enc = Encoding.GetEncoding(
        "UTF-8",
        new EncoderExceptionFallback(),
        new DecoderExceptionFallback()
    );
    
    try
    {
        File.ReadAllText(@"myfile.csv", enc);
    }
    catch (DecoderFallbackException e)
    {
        Console.WriteLine("This file was not encoded in UTF-8, try some other encoding");
    }
    

    Now you get an exception when the file isn’t UTF-8 and you can either try other encoding or let the user know that his file must be in UTF-8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can’t create handler inside thread that has not called Looper.prepare() inside AsyncTask
Possible Duplicate: Realloc is not resizing array of pointers Can anyone tell me where
Possible Duplicate: Mod Rewrite and Using PHP’s GET for URL’s When not Following the
Possible Duplicate: Model.find(1) gives ActiveRecord error when id 1 does not exist If there
Possible Duplicate: How can a Java program use files inside the .jar for read
Possible Duplicate: Generics in for each loop problem if instance does not have generic
Possible Duplicate: Column ‘mary’ does not exist I need to check the values that
Possible Duplicate: How costly is .NET reflection? The elegant solution to a problem I
Possible Duplicate: How do I remove diacritics (accents) from a string in .NET? I
Possible Duplicate: Why and where are \n newline characters getting introduced to c()? I

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.