How to change unicode of a variable in PowerShell

Hi
I am trying to store a value of a git command into a variable. The command results in a name that contains a Danish Alphabet character. When I give that git command only, on the prompt I get the correct result. As shown below:
PS C:\WINDOWS\system32> git config user.nameJohn Møller
but when I store the result of this command into a variable and then display that variable I get different result. what wrong am i doing? Is it something to do with unicode utf8? can I use get-content -encoding utf8 to change the unicode setting of a variable.
I know get-content work with files.
PS C:\WINDOWS\system32> $nameingit = git config user.name
PS C:\WINDOWS\system32> $nameingit
John M├©ller
Any help will be appreciated.
Regrds

This is my code which I am trying to run i PowerShell. I am simply comparing two values. One is coming from a command "$nameingit = git config user.name" and other from $name which full user name of the current user on the machine. next, i first
check if there is any special character in the $name or $nameingit. if it is there then i try to use get-content command to change the unicode to utf8. But it does not work for me. All the links talk about sending out put to file in utf8 but I want to change
the unicode of variable itself so that it can read danish alphabets.
$nameingit = git config user.name
$dom = $env:userdomain
$usr = $env:username
$name=([adsi]"WinNT://$dom/$usr,user").fullname
if ($name -match '[^a-zA-Z0-9 ]')
$name = Get-Content -Encoding UTF8 $name
if ($nameingit -match '[^a-zA-Z0-9 ]')
$nameingit = Get-Content -Encoding UTF8 $nameingit
if ($nameingit.trim() -eq "$name".Trim()) 
$usrchk = "PASS"
else
$usrchk = "Failed"

Similar Messages

  • How to change the font of variables in smart forms dynamicly

    Dear all,
    Is there any suggestion of how to change the font of variables in smart forms dynamicly?
    Thanks in advance.

    Hi,
    You cant change the font dynamically but tell me the scenario I will try to give the solution.
    Regards,
    Nageswar

  • How to change value of instance variable and local variable at run time?

    As we can change value at run time using debug mode of Eclipse. I want to do this by using a standalone prgram from where I can change the value of a variable at runtime.
    Suppose I have a class, say employee like -
    class employee {
    public String name;
    employee(String name){
    this.name = name;
    public int showSalary(){
    int salary = 10000;
    return salary;
    public String showName()
    return name;
    i want to change the value of instance variable "name" and local variable "salary" from a stand alone program?
    My standalone program will not use employee class; i mean not creating any instance or extending it. This is being used by any other calss in project.
    Can someone tell me how to change these value?
    Please help
    Regards,
    Sujeet Sharma

    This is the tutorial You should interest in. According to 'name' field of the class, it's value can be change with reflection. I'm not sure if local variable ('salary') can be changed - rather not.

  • How to change the value of variable in .bpel file

    Hi,
    How can i change the value of variable in .bpel file at time of deployment.
    Can it be possible with configplan.xml or deployment descriptor?
    Thanks
    Richa

    You cannot change the value of variable in .bpel file using config plan. If you want to change value at runtime , you can use Preference variable. Below is the blog to help you understand more.
    http://eelzinga.wordpress.com/2009/10/28/oracle-soa-suite-11g-setting-and-getting-preferences/
    Cheers,
    Durga
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • How to change Order of display variables in WAD.

    Hi,
    I am woking in BW 3.5 WAD.
    I am using a standard template in which 2 queries can be embedded.
    now I have different variables in both the queries hence the order of dispaly variables
    in not as per my desire.
    In query properties we can change the order of varialbes but,
    I want to change that order, how do I achieve it in WAD?
    Thanks & Regards,
    RK.

    If you create a regular playlist in iTunes, you have to update it manually.  Remove old podcast episodes and add new ones, put them in any desired playlist order.
    If you want to automate the process, you can probably get what you need using a Smart Playlist.  To create a new Smart Playlist, click the plus sign below the iTunes sidebar, and select New Smart Playlist.
    Check the box for Match ALL of the following rules.  Then add the rules needed to get what you want on the list.
    The first rule you need is to put podcasts on the playlist. 
    Media Kind - is - Podcast
    To exclude podcasts that have been played
    Plays - is - 0 ("zero")
    Those two rules should give you a playlist with unplayed podcast episodes.  To include only specific podcasts, not all podcasts, use the checkbox for Match only checked items (and you'll need to uncheck the podcasts you don't want on the iPod). 
    Also check the box for Live updating. 
    Click OK.  See if that Smart Playlist creates a playlist with the podcast episodes you want.  If you need to change the rules, right-click on the Smart Playlist and Edit Smart Playlist.  You can post back if you have some other ideas that you want "translated" into rules.
    To put the podcast episodes in order by Date Added, select the Smart Playlist in iTunes so that you see the list of items.  If Date Added is not one of the columns shown on the list, right click in the list's header area and select Date Added.  To sort by Date Added, click on Date Added in the header.  Click on it again, if you need to reverse the order.
    Sync that Smart Playlist to the shuffle.   It should play in the order shown in iTunes.
    An iPod shuffle is meant to be a simple device.  It doesn't have a screen (where you can change a bunch of preference settings), so it is designed to operate in a certain way.  If you need the iPod to work more flexibily, you may want to get an iPod nano instead.

  • How to change a customer exit variable in columns

    Hallo Experts,
    i have a query with two columns. In the first column is a customer exit variable, who get filled with the actual calyear. In the second column is the same variable with an offset -1.
    When i execute the query, in the first column i can see the year 2007 and in the second column i can see 2006. That´s ok.
    Now i want to change the year (dynamically) in a filter 2007 in 2005. The result should be in the first column 2005 and in the second column 2004.
    What can i do?

    Hi Jens,
    As I understand the scenario, you have two RKF or selections in column 1 and 2, one is restricted with variable ZYear, the other with the same variable, offset - 1 and variable ZYear provides current year.
    I think there is no way to change years dynamically in a filter, but you could solve the issue by refreshing the query and overwrite default value provided by customer exit.
    To achieve this, please change variable and check 'Ready for input' in change dialog..
    If this shouldn't work, please let me know details a variable definition and customer exit.
    Have a nice w/e
    Joe

  • How to change value of user variable with change in Page View Dropdown

    Hi All,
    I have a classic planning application, on one of my dataform i put members of Dim_A in Page view and on row view i filter members of Dim_B on the basis of User variable i.e row contains the @Childern(&My_User_Variable). I have following members in both Dimensions:
    Dim_A
    ___A_Mem1
    ___A_Mem2
    ___A_Mem3
    Dim_B
    ___B_Mem1
    ______B_Mem1_1
    ______B_Mem1_2
    ______B_Mem1_3
    ___B_Mem2
    ______B_Mem2_1
    ______B_Mem2_2
    ______B_Mem2_3
    ___B_Mem3
    ______B_Mem3_1
    ______B_Mem3_2
    ______B_Mem3_3
    Now is there any way through which the value of My_User_Variable changes automatically when user select a member of Dim_A in Page View drop down, so that when user press go button then my rows would also be re filtered according to new value of User Variable.
    Right now user first make change in User Variable then select its matching member from Dim_A and then rows are filtered, so i want my user to only make selection in Drop down and press go rest all would be done automatically.

    Hi,
    There was a little controversial post on a similar question:
    Re: Hyperion Planning Data Form
    I love controversy!
    Cheers,
    Alp

  • How to change a Manual Input variable into a customer exit variable?

    Hello,
    I need to change the "processing by" option of an used BEx variable from "Manual Input" to "Customer Exit" but this field is not available (= in grey) in modification.
    Does it exist a tip or a standard program to modify this no-accessible field of an existing BEx variable?
    Thanks in advance for your answers,
    Samuel

    Hi,
    I don't think it's possible (unless tweaking some parameters directly in some tables, as stated in the previous post) so you would have to create a new one and replace it.
    Hope it helps,

  • How to change BPS multiplanning area variable selected value

    Hi!
    I have a variable, Drop down list, filld with an exit. Now the variable is filld with values and the value selected last time is marked as selected when application is started. I need to start with the variable unselected or take control over whitch value to have as selected.
    Any sugestions how to do that?
    Edited by: Jan Kihlström on May 29, 2008 8:38 AM
    Edited by: Jan Kihlström on Jun 10, 2008 9:52 AM

    Hi,
    whenever we execute layout second time, it will always show the last saved variable value.
    what can you do in this case, clear the output of the variable exit at the start in the exit itself.

  • How to change value of a variable by comparison​?

    Hi everyone,
    I have 2 (x and y)local variables that are calculated by some formula, then I want to say if x > y then x=y. I want to know how to make x=y in labview
    thanks
    Solved!
    Go to Solution.

    You seem to be using local variables as "variables", which is a bit odd for LabVIEW. Try to get away from this text programming mentality.
    Feel free to post your code.
    Anyway, here's what you could do.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    XgtYXeqY.jpg ‏3 KB

  • How to use wild card with variable in powershell

    HI
    i am trying to use wild card with variable but getting an error message, "You cannot call a method on a null-valued expression."
    $src = 'C:\Temp'
    $TabletzipPath = $src + "tab*.zip"
    i would like to copy the tablet zip file which is placed in in $src to be copied in $TabletzipPath.
    i am using tab* because this file name changes continuously. so if i give a fix name for example tablet1.zip than it works fine.

    Not sure if the wildcard will work without seeing how you're using the variable.
    That said, I can say that it looks like you're missing the backslash between the $src path and the wildcard filename. As-is the above code assigns a value to $TabletzipPath of "C:\temptab*.zip" instead of what you are likely expecting ("C:\temp\tab*.zip")
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • How to change format of phone numbers in PowerShell?

    We need to append the area code and hyphen in front of the office phone number field in their domain user account for all our users that have office phones now that we are changing from 7 digit numbers to 10 digit numbers.
    I found a script that finds and edits phone numbers, but the author chose a different way to format the numbers.
    This is the part of the script I need to change:
    # Format number as xxx xx xx xxx.
            $Phone = '{0}
    {1} {2} {3}' -f$Phone.Substring(0,3),$Phone.Substring(3,2),$Phone.Substring(5,2),$Phone.Substring(7,3)
    I'm trying to figure out how to edit that so that it formats it as xxx-xxx-xxxx
    (3 digit area code, hyphen, 3 digit prefix, hyphen, four digit number) instead of xxx xx xx xxx.
    Can someone show how to rewrite this section?

    The modified script:
    # This format number as xxx-xxx-xxxx.
    $Phone = '{0}-{1}-{2}' -f $Phone.Substring(0,3),$Phone.Substring(3,3),$Phone.Substring(6,4)
    Hope this helps.
    Regards,
    thennet
    Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions. Thank you!

  • How do change the text color in the variable screen ?

    Hi Experts ,
    I would like to know about , How do change the text color in the variable screen ?
    Using web templates (Analytical) can get the output. It has the variable screen contains 6 fields (Company code, Country , Region , COB, Plant and Purchasing Group). I want to make RED color text on Plant. Please help me .
    Thank you ,
    Prasad.

    Hi,
    I am looking for nearly the same. What I have found is that it seems to manipulate the SAP theme that is used in standard when template is executed in the portal. Just display the source code of the HTML and there you will see the included SAP theme (normally SAP_TRADESHOW). Then you have to go to the SAP portal and change this stuff. But for that you have to know where to find it and what impact this change has.
    I am not pretty sure if this is the right way. But as I want to change the standard layout of a whole template to a customer specific layout I think there is no other way in BI7.0.
    Regards,
    Peter

  • How to change variable values ?

    Dear friends,
    How to change variable values when we are broadcasting the Queires ?
    Do we need to change them everytime ?
    Thanks,
    N

    Hi,
    Please go through it.
    /people/ramkumar.ghattamaneni/blog/2008/02/25/using-variables-while-broadcasting-queries-to-the-portal-in-bi-7
    Regards,
    Ramkumar.

  • How to change the default Path of Prompt Played by MicroApp

    Hi
    I need to store all the Self Service application prompts in dedicated Media Server. I can modify location of all the Media files by passing the related URL form CVP application, however I need to know how to change the default location of Prompt file played by Play Media Microapplication in ICM Scripting.
    Currently the default location taken by Play Media Micro App is the Media _Server.variable path set for VXML Server location while I have a separate Media Server.
    Please advice how we can customize the MicroApp Media path.
    regards
    Kapil Kumar

    Hi Kapil,
    Try this in your ICM script, define set variables i.e.
    set Media Server= ip address of media server
    set Locale = en-us
    set input Type = DTMF only
    set App Media Lib = " you new location i.e. test "
    So, the application path will be
    http://media server ip address/en-us/test
    hope this helps.
    Cheers

Maybe you are looking for

  • ORA-08103: object no longer exists

    Dear Experts, I have a very tricky situation here. A background job runs daily on our Production, which kinds of populates a lot of tables in another database (warehouse). This morning, the job failed with an error: ORA-08103: object no longer exists

  • List of Sales set

    How to view the list of sales set?urgent..

  • Transporter tab in GR MIGO

    Dear all,   How can I add Transporter Tab in MIGO for 101 movement type without BADI or any Z development?Can I add extra field in item wise with out help of abapers? Thanks & Regards Dipayan Bose

  • Sorting all records in datagrid

    Hi All, I have a datagrid with pagination. On default or on click of the sort arrow of a particular column in the grid  it sorts only the current page data. my requirement is it should sort across all records returned in array collection not only the

  • Something is «new» with Apple

    Whenever I loaded a new Version of OS X after 10.5, regardless regardless of Intel Core Duo, i5 or i7, I had to reload printer, scanner and other drivers. It became exponentially more time consuming particularly. With Mavericks, Apple has approached