从右到左保存txt文件中的一些文本 [英] Save some text in txt file right to left

查看:118
本文介绍了从右到左保存txt文件中的一些文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

如何使用c#编写代码,下载一些文本格式为txt格式,此文本在下载文件中从右到左定位

Hi...
How can I write code with c# that download some text with txt format that this text locate right to left in the downloaded file

Response.Clear();
Response.Buffer = false;
Response.AddHeader("content-disposition", "attachment;filename=Export.txt");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-notepad";

using (StringWriter sw = new StringWriter())
{
    HtmlTextWriter hw = new HtmlTextWriter(sw);
    
    sw.Write(ViewState["resultForDownload"].ToString());
    Response.Output.Write(sw.ToString());
    Response.Flush();
    Response.End();
}



此代码在txt文件中从左到右存储一些文本,但我想从右到左保存此文本。


This code store some text from left to right in txt file, but I want to save this text from right to left.

推荐答案

这个问题正在制定之中并没有多大意义。这些文件没有一定的从左到右或从左到右的方向,它们只是字节序列。此外,Unicode文本文件可以包含以从左到右和从左到右的语言编写的片段(在文本编辑器中编辑这样的文件是一个特定的挑战;我经常必须这样做,在此论坛上回答问题) :-))。然而,存储此类数据(文件只是存储,让我们记住它)根本不是问题。



您显示的代码片段表明您正在处理使用HTTP请求和响应,严格来说,也不是文件,区别不仅仅是形式上的(特别是,在UTF-8 HTTP响应内容中,BOM是无关紧要的,但带编码的HTTP-EQUIV很重要)。网页也可以自由组合左写和左右写的语言。



也许你需要根据最终目标来解释你的问题有。



-SA
The question, as it is formulated, doesn't really makes sense. The files don't have certain left-to-write or write-to-left direction, they are just sequences of bytes. Moreover, a Unicode text file can have fragments written in left-to-write and write-to-left languages (editing such files in a text editors is a certain challenge; I regularly have to do it, ofter for answering question on this forum :-)). Storage of such data, however (file is just the storage, let's remember it) is not a problem at all.

The code fragment you show suggests that you are dealing with HTTP request and response, which is also, strictly speaking, not a file, and the difference is not just formal (in particular, BOM is insignificant in UTF-8 HTTP response content, but HTTP-EQUIV with encoding is important). Web pages also can freely combine text in left-to-write and write-to-left languages.

Perhaps you need to explain your problem in terms of ultimate goals you have.

—SA


文本文件没有从右到左或任何其他格式的格式,都有原始文件,新行被识别,使生活稍微容易。



只有当你查看你的内容时可以指定您希望如何处理数据,包括左/右方向 - 但它全部位于您用来查看数据的容器上,而不是数据本身的一部分。
Text files don't have Right-to-Left or any other form of formatting, there are "raw" files, with new lines being recognised to make life slightly easier.

It is only when you view the content that you can specify how you want the data treated, and that includes the left/right orientation - but it is all on the container you use to view the data, not a part of the data itself.


这篇关于从右到左保存txt文件中的一些文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆