解析带有奇怪“â”字符的格式错误的 JS 字符串
Parseing malformed JS string with weird "â" characters
我正在 https://remoteok.io/api 使用 remoteok api 构建一个小项目。我正在尝试将它们重新转换为格式良好的 markdown,以便我的前端进行解析。
里面有 HTML 标签的那些我没问题,但是那些没有的,我真的无能为力,因为所有换行符和其他字符都显示为
完整列表如下所示:
文本形式的字符串:
" Popdog is exploring the relationship between gaming content creators
and their communities. We believe that while creators are fantastic at
building audiences, thereâs much yet to be done to create real
community. But weâre in need of more great people to see that
happen. Weâre a remote-first, venture-backed, fast-growing company
that believes in the power of live streaming and content creation in
gaming. Our team is small and singularly focused on changing the world
of gaming for the better. This position spearheads brand marketing and
community growth and engagement as they intersect. The role would
focus on clear brand development, evolution, and reach across
traditional and experimental marketing channels, as well as building
out a foundational community development plan for users and talent
alike. This role would act as a public-facing mouth-piece for the
company, facilitating Popdogâs place within the industry and
garnering support and intel from users to improve user experience. We
aim to be the best at meeting viewers and creators where they are and
supporting them. Benefits Medical, Dental, and Vision Insurance
Company paid life insurance, short term and long term disability
insurance 401k plan with 4% company matching Flexible work schedule
Generous PTO Popdog, Inc. is an Equal Opportunity / Affirmative Action
employer. All qualified applicants will receive consideration for
employment without regard to race, color, religion, sex, sexual
orientation, national origin, disability, or protected Veteran status
"
具有完整换行符和段落的列表的URL:https://remoteok.io/remote-jobs/101454-remote-brand-community-manager-popdog-x-loaded
我正在尝试将其恢复为 link 中的表单。它与另一个 post 不重复,因为目前两者都没有解决方案。必须有一种方法将这些字符解析为换行符。
我该怎么做才能正确查看这些字符,更不用说解析它们了?我什至不知道从什么开始查找。
这样的东西行得通吗?
fetch('https://remoteok.io/api')
.then(response => response.json())
.then(data => {
data.forEach((item) => item.description = decode_utf8(item.description));
console.log(data);
})
function decode_utf8(s) {
return decodeURIComponent(escape(s));
}
我正在 https://remoteok.io/api 使用 remoteok api 构建一个小项目。我正在尝试将它们重新转换为格式良好的 markdown,以便我的前端进行解析。
里面有 HTML 标签的那些我没问题,但是那些没有的,我真的无能为力,因为所有换行符和其他字符都显示为
完整列表如下所示:
文本形式的字符串:
" Popdog is exploring the relationship between gaming content creators and their communities. We believe that while creators are fantastic at building audiences, thereâs much yet to be done to create real community. But weâre in need of more great people to see that happen. Weâre a remote-first, venture-backed, fast-growing company that believes in the power of live streaming and content creation in gaming. Our team is small and singularly focused on changing the world of gaming for the better. This position spearheads brand marketing and community growth and engagement as they intersect. The role would focus on clear brand development, evolution, and reach across traditional and experimental marketing channels, as well as building out a foundational community development plan for users and talent alike. This role would act as a public-facing mouth-piece for the company, facilitating Popdogâs place within the industry and garnering support and intel from users to improve user experience. We aim to be the best at meeting viewers and creators where they are and supporting them. Benefits Medical, Dental, and Vision Insurance Company paid life insurance, short term and long term disability insurance 401k plan with 4% company matching Flexible work schedule Generous PTO Popdog, Inc. is an Equal Opportunity / Affirmative Action employer. All qualified applicants will receive consideration for employment without regard to race, color, religion, sex, sexual orientation, national origin, disability, or protected Veteran status "
具有完整换行符和段落的列表的URL:https://remoteok.io/remote-jobs/101454-remote-brand-community-manager-popdog-x-loaded
我正在尝试将其恢复为 link 中的表单。它与另一个 post 不重复,因为目前两者都没有解决方案。必须有一种方法将这些字符解析为换行符。
我该怎么做才能正确查看这些字符,更不用说解析它们了?我什至不知道从什么开始查找。
这样的东西行得通吗?
fetch('https://remoteok.io/api')
.then(response => response.json())
.then(data => {
data.forEach((item) => item.description = decode_utf8(item.description));
console.log(data);
})
function decode_utf8(s) {
return decodeURIComponent(escape(s));
}