@Pista

Как отформатировать текст для отправки по REST API WORDPRESS?

Необходимо подготовить текст для отправки по REST API Wordpress

ИСХОДНЫЙ ТЕКСТ
It's hard to believe, but I've never tested what actually happens if you do an rm -rf on the entire root partition. Once, early in my career, I made a mistake with a delete and ran a root delete. But it wasn't the rm command, it was something else. I don't remember the details anymore. Back then the servers were still ironclad and it really became a problem. The server had not been put into production yet, but I had already configured something on it. I immediately noticed the error and canceled the command. At first I thought it was nothing, but then I noticed that all symbolic links were missing, although the system was working in general and rebooted normally. I had to redo everything anyway.

And now I decided to see what would really happen after rm -rf / on a test virtualization. The command did not work in this form and asked me to add the --no-preserve-root key. I did so:
# rm -rf / --no-preserve-root

And everything was really deleted except the /dev partition and the loaded system modules in /sys/module/. And it was so mundane, without any special messages, fatal errors or anything else. You are sitting in a system where there is nothing but what was loaded into memory. The bash shell works, you can do something, but not much. There's no binary.

Only those utilities built into the shell work. For example, echo, pwd, type, cd, etc..:
# type cd
cd is a shell builtin
That is, you can move to /sys/module/. But you can't do anything there. You cannot connect to a new session or log in through the terminal. You cannot even do the reboot command. It's a binary, and it doesn't exist. Nevertheless


Преобразуем данный текст https://www.freeformatter.com/json-escape.html#bef...

На выходе:

It's hard to believe, but I've never tested what actually happens if you do an rm -rf on the entire root partition. Once, early in my career, I made a mistake with a delete and ran a root delete. But it wasn't the rm command, it was something else. I don't remember the details anymore. Back then the servers were still ironclad and it really became a problem. The server had not been put into production yet, but I had already configured something on it. I immediately noticed the error and canceled the command. At first I thought it was nothing, but then I noticed that all symbolic links were missing, although the system was working in general and rebooted normally. I had to redo everything anyway. \r\n\r\nAnd now I decided to see what would really happen after rm -rf \/ on a test virtualization. The command did not work in this form and asked me to add the --no-preserve-root key. I did so:\r\n# rm -rf \/ --no-preserve-root\r\n\r\nAnd everything was really deleted except the \/dev partition and the loaded system modules in \/sys\/module\/. And it was so mundane, without any special messages, fatal errors or anything else. You are sitting in a system where there is nothing but what was loaded into memory. The bash shell works, you can do something, but not much. There's no binary. \r\n\r\nOnly those utilities built into the shell work. For example, echo, pwd, type, cd, etc..:\r\n# type cd\r\ncd is a shell builtin\r\nThat is, you can move to \/sys\/module\/. But you can't do anything there. You cannot connect to a new session or log in through the terminal. You cannot even do the reboot command. It's a binary, and it doesn't exist. Nevertheless


Собственно здесь все было отформатировано по правилам:

  • Backspace заменяется на \b
  • Передача формы заменяется на \f
  • Новая строка заменяется на \n
  • Возврат каретки заменяется на \r
  • Табуляция заменяется на \t
  • Двойная кавычка заменяется на \"
  • Обратная косая черта заменяется на \\\

Как это реализовать Через C# или JS? Чтобы не прибегать к онлайн сервисам
  • Вопрос задан
  • 111 просмотров
Решения вопроса 1
VoidVolker
@VoidVolker Куратор тега JavaScript
Dark side eye. А у нас печеньки! А у вас?
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы