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

Help evaluating integral (anything simple that I am missing?)

Is it okay for a ticket seller to grab a tip in the USA?

Why are Gatwick's runways too close together?

What are the conventions for transcribing Semitic languages into Greek?

Ex-contractor published company source code and secrets online

Three legged NOT gate? What is this symbol?

Is it incorrect to write "I rate this book a 3 out of 4 stars?"

Can you castle with a "ghost" rook?

Does this Foo machine halt?

Trying to write a shell script that keeps testing a server remotely, but it keeps falling in else statement when I logout

What does Apple mean by "This may decrease battery life"?

Wherein the Shatapatha Brahmana it was mentioned about 8.64 lakh alphabets in Vedas?

How can I iterate this process?

Is Calculus necessary for computer science student?

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

Simple Stop watch which i want to extend

First amendment and employment: Can a police department terminate an officer for speech?

I accidentally overwrote a Linux binary file

How to create all combinations from a nested list while preserving the structure using R?

Dropdowns & Chevrons for Right to Left languages

Blocking people from taking pictures of me with smartphone

What skills in 5e give trap knowledge (i.e. the equivalent of Dungeoneering in 4e)?

Plausibility of Ice Eaters in the Arctic

Was the 2019 Lion King film made through motion capture?



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

1079 bronze badges




1079 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권, 지리지 충청도 공주목 은진현