How to get the raw numeric HTML representation of special characters?What special characters must be escaped in regular expressions?Detect encoding and make everything UTF-8Form character encoding problems with special charactersUTF-8 in Windows 7 CMDHow to correctly insert utf-8 characters into a MySQL table using jpaHow change the default UTF-8 encoding to LATIN1All special characters are question marks in PHP/HTMLusing special characters in jquery html not showing correctlyChanging default encoding of vim to utf-8 not workingReplace special characters in a string (like "{ by { ) in R

How far did Gandalf and the Balrog drop from the bridge in Moria?

Understanding the point of a kölsche Witz

Bitcoin successfully deducted on sender wallet but did not reach receiver wallet

How to create events observer that only call when REST api dispatch events?

Safest way to store environment variable value in a file

How can God warn people of the upcoming rapture without disrupting society?

These were just lying around

Do beef farmed pastures net remove carbon emissions?

What is a good class if we remove subclasses?

Enigma between Collegues (Part1)

How many people would you need to pull a whale over cobblestone streets?

Boss wants me to ignore a software license

Heat equation: Squiggly lines

Is there a standardised way to check fake news?

How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?

Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?

If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?

Are differences between uniformly distributed numbers uniformly distributed?

A continuous water "planet" ring around a star

Why did Gandalf use a sword against the Balrog?

Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?

On math looking obvious in retrospect

Why is there a large performance impact when looping over an array over 240 elements?

How can Radagast come across Gandalf and Thorin's company?



How to get the raw numeric HTML representation of special characters?


What special characters must be escaped in regular expressions?Detect encoding and make everything UTF-8Form character encoding problems with special charactersUTF-8 in Windows 7 CMDHow to correctly insert utf-8 characters into a MySQL table using jpaHow change the default UTF-8 encoding to LATIN1All special characters are question marks in PHP/HTMLusing special characters in jquery html not showing correctlyChanging default encoding of vim to utf-8 not workingReplace special characters in a string (like "{ by { ) in R






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















When I type "xfc" into R it leads to [1] "ü". I don't want that, I want this to lead to [1] "xfc". I also do not really understand why Encoding("xfc") is "latin1" although I changed the settings in Code->Saving to UTF-8. I want to write a function that replaces some special characters like "ü" by "xfc" but I can't achieve this:



> stringr::str_replace_all("Müller", "ü", "xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Mxfcller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\\xfc")
[1] "M\xfcller"


What I really want is [1] "Mxfcller"



(How) can I achieve this?










share|improve this question


























  • check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

    – brettljausn
    Mar 27 at 8:48

















3















When I type "xfc" into R it leads to [1] "ü". I don't want that, I want this to lead to [1] "xfc". I also do not really understand why Encoding("xfc") is "latin1" although I changed the settings in Code->Saving to UTF-8. I want to write a function that replaces some special characters like "ü" by "xfc" but I can't achieve this:



> stringr::str_replace_all("Müller", "ü", "xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Mxfcller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\\xfc")
[1] "M\xfcller"


What I really want is [1] "Mxfcller"



(How) can I achieve this?










share|improve this question


























  • check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

    – brettljausn
    Mar 27 at 8:48













3












3








3








When I type "xfc" into R it leads to [1] "ü". I don't want that, I want this to lead to [1] "xfc". I also do not really understand why Encoding("xfc") is "latin1" although I changed the settings in Code->Saving to UTF-8. I want to write a function that replaces some special characters like "ü" by "xfc" but I can't achieve this:



> stringr::str_replace_all("Müller", "ü", "xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Mxfcller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\\xfc")
[1] "M\xfcller"


What I really want is [1] "Mxfcller"



(How) can I achieve this?










share|improve this question
















When I type "xfc" into R it leads to [1] "ü". I don't want that, I want this to lead to [1] "xfc". I also do not really understand why Encoding("xfc") is "latin1" although I changed the settings in Code->Saving to UTF-8. I want to write a function that replaces some special characters like "ü" by "xfc" but I can't achieve this:



> stringr::str_replace_all("Müller", "ü", "xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Mxfcller"
> stringr::str_replace_all("Müller", "ü", "\xfc")
[1] "Müller"
> stringr::str_replace_all("Müller", "ü", "\\xfc")
[1] "M\xfcller"


What I really want is [1] "Mxfcller"



(How) can I achieve this?







r regex encoding special-characters






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 9:18







TobiSonne

















asked Mar 27 at 8:26









TobiSonneTobiSonne

10710 bronze badges




10710 bronze badges















  • check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

    – brettljausn
    Mar 27 at 8:48

















  • check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

    – brettljausn
    Mar 27 at 8:48
















check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

– brettljausn
Mar 27 at 8:48





check out ?Quotes, it seems like R interprets "xnn" as character with the hexcode nn. I do not know if there is a workaround for this behaviour

– brettljausn
Mar 27 at 8:48












1 Answer
1






active

oldest

votes


















0














The last line gives the result you want. The backslash is escaped when the string is printed. To see that, let's save the string to file and then see the content of the file.




s <- stringr::str_replace_all("Müller", "ü", "\\xfc")

writeLines(s, "test.txt")

cat(readLines("test.txt"))
#> Mxfcller


Created on 2019-03-27 by the reprex package (v0.2.1)



Also see this GitHub issue: https://github.com/STAT545-UBC/Discussion/issues/394






share|improve this answer

























  • x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

    – TobiSonne
    Mar 27 at 9:15












  • R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

    – dipetkov
    Mar 27 at 9:26











  • Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

    – dipetkov
    Mar 27 at 9:31











  • s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

    – TobiSonne
    Mar 27 at 11:30







  • 1





    R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

    – dipetkov
    Mar 27 at 11:52










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372670%2fhow-to-get-the-raw-numeric-html-representation-of-special-characters%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The last line gives the result you want. The backslash is escaped when the string is printed. To see that, let's save the string to file and then see the content of the file.




s <- stringr::str_replace_all("Müller", "ü", "\\xfc")

writeLines(s, "test.txt")

cat(readLines("test.txt"))
#> Mxfcller


Created on 2019-03-27 by the reprex package (v0.2.1)



Also see this GitHub issue: https://github.com/STAT545-UBC/Discussion/issues/394






share|improve this answer

























  • x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

    – TobiSonne
    Mar 27 at 9:15












  • R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

    – dipetkov
    Mar 27 at 9:26











  • Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

    – dipetkov
    Mar 27 at 9:31











  • s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

    – TobiSonne
    Mar 27 at 11:30







  • 1





    R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

    – dipetkov
    Mar 27 at 11:52















0














The last line gives the result you want. The backslash is escaped when the string is printed. To see that, let's save the string to file and then see the content of the file.




s <- stringr::str_replace_all("Müller", "ü", "\\xfc")

writeLines(s, "test.txt")

cat(readLines("test.txt"))
#> Mxfcller


Created on 2019-03-27 by the reprex package (v0.2.1)



Also see this GitHub issue: https://github.com/STAT545-UBC/Discussion/issues/394






share|improve this answer

























  • x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

    – TobiSonne
    Mar 27 at 9:15












  • R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

    – dipetkov
    Mar 27 at 9:26











  • Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

    – dipetkov
    Mar 27 at 9:31











  • s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

    – TobiSonne
    Mar 27 at 11:30







  • 1





    R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

    – dipetkov
    Mar 27 at 11:52













0












0








0







The last line gives the result you want. The backslash is escaped when the string is printed. To see that, let's save the string to file and then see the content of the file.




s <- stringr::str_replace_all("Müller", "ü", "\\xfc")

writeLines(s, "test.txt")

cat(readLines("test.txt"))
#> Mxfcller


Created on 2019-03-27 by the reprex package (v0.2.1)



Also see this GitHub issue: https://github.com/STAT545-UBC/Discussion/issues/394






share|improve this answer













The last line gives the result you want. The backslash is escaped when the string is printed. To see that, let's save the string to file and then see the content of the file.




s <- stringr::str_replace_all("Müller", "ü", "\\xfc")

writeLines(s, "test.txt")

cat(readLines("test.txt"))
#> Mxfcller


Created on 2019-03-27 by the reprex package (v0.2.1)



Also see this GitHub issue: https://github.com/STAT545-UBC/Discussion/issues/394







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 9:11









dipetkovdipetkov

1,4961 silver badge8 bronze badges




1,4961 silver badge8 bronze badges















  • x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

    – TobiSonne
    Mar 27 at 9:15












  • R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

    – dipetkov
    Mar 27 at 9:26











  • Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

    – dipetkov
    Mar 27 at 9:31











  • s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

    – TobiSonne
    Mar 27 at 11:30







  • 1





    R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

    – dipetkov
    Mar 27 at 11:52

















  • x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

    – TobiSonne
    Mar 27 at 9:15












  • R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

    – dipetkov
    Mar 27 at 9:26











  • Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

    – dipetkov
    Mar 27 at 9:31











  • s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

    – TobiSonne
    Mar 27 at 11:30







  • 1





    R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

    – dipetkov
    Mar 27 at 11:52
















x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

– TobiSonne
Mar 27 at 9:15






x <- readLines("test.txt"). Now x is still "M\xfcller". I want to pass x to another function and x has to be "Mxfcller"

– TobiSonne
Mar 27 at 9:15














R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

– dipetkov
Mar 27 at 9:26





R treat strings a little bit differently. If you try x = "Mxfcller", you get "Müller".

– dipetkov
Mar 27 at 9:26













Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

– dipetkov
Mar 27 at 9:31





Also, you can see in the file that the string is Mxfcller but R shows it as M\xfcller.

– dipetkov
Mar 27 at 9:31













s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

– TobiSonne
Mar 27 at 11:30






s <- "ab" and print(s) leads to "ab" und not "a\b" so there must be a difference? Or am I wrong?

– TobiSonne
Mar 27 at 11:30





1




1





R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

– dipetkov
Mar 27 at 11:52





R doesn't interpret "b" as a special character. Try "ax" and you get an error about "hex digits" which is what "xfc" is.

– dipetkov
Mar 27 at 11:52








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372670%2fhow-to-get-the-raw-numeric-html-representation-of-special-characters%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현