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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:44:59+00:00 2026-06-05T21:44:59+00:00

Currently I have a powershell proccess that is scanning a SQL Server Table and

  • 0

Currently I have a powershell proccess that is scanning a SQL Server Table and is reading a columns containing text. Currently we have characters that are in the extended ASCII land that are causing our downstream processes to break. I was orginally idenitfying these differences in SQL Server but it is terrible at text parsing so I decided to write a powershell script to do this that combined regular expressions. I will post the code for that as well to help other lost souls looking for such a regex.

$x = [regex]::Escape("\``~!@#$%^&*()_|{}=+:;`"'<,>.?/-")
$y = "([^A-z0-9 \0x005D\0x005B\t\n"+$x+"])"
$a =  [regex]::match( $($Row[1]), $y)

The problem comes when I want to display some of the ascii values back in an email saying that I’m scrubbing the data. The numbers don’t come out the same as SQL Server. Caution I’m not sure if your results will be the same copying from you browser because these are extended ascii.

In powershell

[int]"–"[-0]; #result 8211 that appears to be wrong
[int]" "[-0]; #result 160 this appears to be right

In SQL Server

select ASCII('–') --result 150
select ASCII(' ') --result 160

What in powershell will help you to get the same results as SQL Server on the ASCII look up, if there is one.

TLDR; So my question is, is the above the correct method to look up ASCII values in powershell because it works for most values but doesn’t work for the ASCII value 150 (this is the long dash that is from word).

  • 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-05T21:45:00+00:00Added an answer on June 5, 2026 at 9:45 pm

    In SQL Server,

    select UNICODE('–')
    

    will return 8211.

    I don’t think PowerShell supports ANSI, except for I/O; it works in Unicode internally.

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

Sidebar

Related Questions

I'm currently exploring powershell capabilities, but I have encountered a problem that I have
I currently have a PowerShell script that is used for complex automated Exchange mailbox
I have a SQL 2005 instance that runs a job that uses a Powershell
I currently have a VBScript that allows me to call arbitrary powershell commands, which
I currently have an algorithm that generates a point grid. It takes input from
I currently have the following that will search a field within my db for
I'm pretty new to Powershell. I have 2 different scripts I'm running that I
I have a Powershell script that reads values off of the pipeline: PARAM (
I am have a powershell script that does a few things that all need
I am currently trying to write a little powershell script (I have no experience

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.