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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:26:36+00:00 2026-06-14T11:26:36+00:00

I have a process that reads data using the Windows 1252 codepage (input from

  • 0

I have a process that reads data using the Windows 1252 codepage (input from a SQL Server 2008 varchar field). I then write this data to a flat text file, which is picked up by an IBM mainframe system that uses the EBCDIC 37 codepage. That system converts the file to its own character set. However, some things in the extended ASCII range (char codes 128 – 255) don’t get converted nicely by the mainframe. I think this is because certain characters in the Windows character set do not exist in the EBCDIC character set.

Is there a general way to determine what characters I need to filter out, such as a left single quote, right single quote, left double quote, right double quote, bullet, en dash, and em dash, (Windows codes 145 – 151, respectively), to name a few? If so, is there some algorithm I can use to determine what the closest EBCDIC equivalent might be (such as a normal single quote for either a left single quote or a right single quote)?

  • 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-14T11:26:38+00:00Added an answer on June 14, 2026 at 11:26 am

    I was looking for a general way to solve this problem instead of focusing on just EBCDIC 37, and I didn’t want to visually compare two charts of codes. I wrote a short program (in VB.NET) to find all of the characters that exist in one codepage and not the other.

    ' Pick source and target codepages.
    Dim sourceEncoding As Encoding = Encoding.Default ' This is Windows 1252 on Windows OS.
    Dim targetEncoding As Encoding = Encoding.GetEncoding("IBM037")
    
    ' Get every character in the codepage.
    Dim inbytes(256) As Byte
    For code As Integer = 0 To 255
        inbytes(code) = Convert.ToByte(code)
    Next
    
    ' Convert the bytes from the source encoding to the target, then back again.
    ' Those bytes that convert back to the original value exist in both codepages.
    ' The bytes that change do not exist in the target encoding.
    Dim input As String = sourceEncoding.GetString(inbytes)
    Dim outbytes As Byte() = Encoding.Convert(sourceEncoding, targetEncoding, inbytes)
    Dim convertedbytes As Byte() = Encoding.Convert(targetEncoding, sourceEncoding, outbytes)
    Dim output As String = sourceEncoding.GetString(convertedbytes)
    Dim diffs As New List(Of Char)()
    For idx As Integer = 0 To input.Length - 1
        If input(idx) <> output(idx) Then
            diffs.Add(input(idx))
        End If
    Next
    
    ' Print results.
    Console.WriteLine("Source: " + input)
    Console.WriteLine("(Coded): " + String.Join(" ", inbytes.Select(Function (x) Convert.ToInt32(x).ToString()).ToArray()))
    Console.WriteLine()
    Console.WriteLine("Target: " + output)
    Console.WriteLine("(Coded): " + String.Join(" ", convertedbytes.Select(Function (x) Convert.ToInt32(x).ToString()).ToArray()))
    Console.WriteLine()
    Console.WriteLine("Cannot convert: " + String.Join(" ", diffs.Select(Function (x) Convert.ToInt32(x).ToString()).ToArray()))
    

    For the case of Windows 1252 to EBCDIC 37, there are 27 characters that do not map. I chose what I thought was the best equivalent for those characters.

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

Sidebar

Related Questions

i have a web service that reads data from excel using Microsoft.Office.Interop.Excel. It works
I have Process objects that are monitored from two different views. A Windows.Forms.ListView (actually
I have a process that imports a lot of data (950k rows) using inserts
We currently have an application that reads data from serial communications. Throughout the application
I have a module that reads the StandardError of a process. Everything works fine,
I have a c# app (Windows Service) that fires a timer event that reads
In a function that reads data (data meaning exclusively strings) from disk, which should
Let's say I want to have a function which reads data from the SerialPort
I have a simple process which reads from one queue, processes the messages, and
I have a process that parses an XML file using JDOM and xpath to

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.