我正在使用postgres数据库,我有一个名为names的表,其中有一个名为'info‘的列,其类型为json。我正在添加
{ "info": "security" , description : "Sednit update: Analysis of Zebrocy: The Sednit group \u2013 also known as APT28, Fancy Bear, Sofacy or STRONTIUM \u2013 is a group of attackers operating since 2004, if not earlier, and whose main objective is to steal confidential information from specific targets.\n\nToward the end of 2015, we started seeing a new component deployed by the group; a downloader for the main Sednit backdoor, Xagent. Kaspersky mentioned this component for the first time in 2017 in their APT trend report and recently wrote an article where they quickly described it under the name Zebrocy.\n\nThis new component is a family of malware, comprising downloaders and backdoors written in Delphi and AutoIt. These components play the same role in the Sednit ecosystem as Seduploader; that of first-stage malware."}在这里,我使用了node js,将sequelize作为orm。当我把它保存在表中的时候。我看到"\n“代表"\n”," \u“代表\u。是否有人可以帮助我在保存到表中时避免转义字符。
发布于 2018-11-19 13:30:49
我看到\n代表\n,而\u代表\u。
在您的json描述中的类型是string,所以它会将新行/ enter 转换为\n,这是默认行为,否则当您再次尝试获取数据时,您将不会得到新行/enter。
而\u用于unicode,您可能会保存一些smily或特殊字符,以便将其转换为此类字符串。
所以没有bug,这就是它的工作方式。
https://stackoverflow.com/questions/53368565
复制相似问题