英文:
Save Rtf text in Postgresql
问题
我需要在Postgres中保存类似于这样的RTF文本{\rtf1deff0{\fonttbl
。如果我尝试像这样保存,它只会保存{
。看起来我需要将每个反斜杠替换为双反斜杠。尝试过像这样的方式'{\rtf1deff0{\fonttbl'
但在数据库中仍然得到{
。
英文:
I need to save something like this RTF text '{\rtf1deff0{\fonttbl' in Postgres. If I try to save like this, it saves only '{'. It looks like I need to replace every backslash with a double backslash. Tried like this '{\rtf1deff0{\fonttbl'.replace(/\\/g, "\\")
but still getting '{' in database.
update cxema_npa.reestr_npa set data = '{\rtf1deff0{\fonttbl' where cxema_npa.reestr_npa.id = 617
答案1
得分: 1
如果在将该SQL语句输入交互式数据库客户端时无法按照您的期望运行,那么您必须已将配置参数standard_conforming_strings = off
设置为关闭,以便PostgreSQL将\n
解释为换行符。请将该参数更改为on
。
如果这不是问题的原因,那么问题可能出现在您(未透露的)应用程序编程语言中。
英文:
If that SQL statement does not work as you want it to when you type it into an interactive database client, you must have set the configuration parameter standard_conforming_strings = off
, so that PostgreSQL interprets \n
as a newline character. Change that parameter to on
.
If that is not the problem, the problem must be in your (undisclosed) application programming language.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论