<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Кодировка текстовика при передаче на сервер через php]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12871&amp;type=atom" />
	<updated>2017-08-05T00:15:20Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=12871</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117819#p117819" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, страница то пустая, но переданный текст всё равно записывается в файл. Разобрался, скорее всего данные не записывались в текстовик на сервере, потому что читаемый файл был слишком длинным. Короткие строчки приходят нормально и корректно отображаются. Благодарю всех за помощь.</p>]]></content>
			<author>
				<name><![CDATA[NuboCoder]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34031</uri>
			</author>
			<updated>2017-08-05T00:15:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117819#p117819</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117802#p117802" />
			<content type="html"><![CDATA[<p>Попробуйте код из поста номер 9.<br />А свой php измените на такой:<br /></p><div class="codebox"><pre><code>&lt;?php 

 $Text = $_GET[&#039;Text&#039;];

 $file = &#039;textfile.txt&#039;;

 $current = file_get_contents($file);
 if (file_exists($file)) {
    $current .= &quot;$Text\n&quot;;
} else {
    $current .= &quot;\xEF\xBB\xBF$Text\n&quot;;
}

file_put_contents($file, $current);

 ?&gt;</code></pre></div><p>А в ответ ничего не приходит, так как ничего и не должно приходить.<br />Запустите &quot;http://test-site.ru/myname.php?Text=тест&quot; в броузере и увидите пустую страницу.<br />С помощью urldownloadtofile вы делаете тоже самое, только еще эту пустую страницу сохраняете.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-08-04T10:00:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117802#p117802</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117800#p117800" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, во что он превращает значение переменной &quot;TextVar&quot;:</p><p><span class="postimg"><img src="http://f1.s.qip.ru/N7Lfc7kA.png" alt="http://f1.s.qip.ru/N7Lfc7kA.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[NuboCoder]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34031</uri>
			</author>
			<updated>2017-08-04T07:56:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117800#p117800</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117799#p117799" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, вообще ничего не приходит.</p>]]></content>
			<author>
				<name><![CDATA[NuboCoder]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34031</uri>
			</author>
			<updated>2017-08-04T07:50:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117799#p117799</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117797#p117797" />
			<content type="html"><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>FileRead, TextVar, C:\logs\myname.txt
TextVar := URIEncode(TextVar)
URLDownloadToFile, http://test-site.ru/myname.php?Text=%TextVar%, %a_temp%\response.txt

URIEncode(str, encoding := &quot;UTF-8&quot;)  {
   VarSetCapacity(var, StrPut(str, encoding))
   StrPut(str, &amp;var, encoding)

   While code := NumGet(Var, A_Index - 1, &quot;UChar&quot;)  {
      bool := (code &gt; 0x7F || code &lt; 0x30 || code = 0x3D)
      UrlStr .= bool ? &quot;%&quot; . Format(&quot;{:02X}&quot;, code) : Chr(code)
   }
   Return UrlStr
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-04T06:17:19Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117797#p117797</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117792#p117792" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, простите, я не понимаю, не подскажите, как это правильно использовать в моём случае?</p>]]></content>
			<author>
				<name><![CDATA[NuboCoder]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34031</uri>
			</author>
			<updated>2017-08-04T04:09:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117792#p117792</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117775#p117775" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А что, так можно? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p></blockquote></div><p>Да, параметры же передаются скрипту в массиве _GET. А в ответ он тоже может что-нибудь передать, и UrlDownloadToFile сохранит его ответ в файл.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2017-08-03T15:34:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117775#p117775</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117774#p117774" />
			<content type="html"><![CDATA[<p>Во всяком случае, кириллица в URL должна быть перекодирована с помощью:<br /></p><div class="codebox"><pre><code>URIEncode(str, encoding := &quot;UTF-8&quot;)  {
	VarSetCapacity(var, StrPut(str, encoding))
	StrPut(str, &amp;var, encoding)

   While code := NumGet(Var, A_Index - 1, &quot;UChar&quot;)  {
		bool := (code &gt; 0x7F || code &lt; 0x30 || code = 0x3D)
		UrlStr .= bool ? &quot;%&quot; . Format(&quot;{:02X}&quot;, code) : Chr(code)
   }
   Return UrlStr
}</code></pre></div><p>с указанием нужной кодировки.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-03T15:32:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117774#p117774</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117772#p117772" />
			<content type="html"><![CDATA[<p>А что, так можно? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-03T14:57:24Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117772#p117772</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117771#p117771" />
			<content type="html"><![CDATA[<p>Видимо, вызывает PHP-скрипт с параметром, в котором передаётся текст файла.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2017-08-03T13:57:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117771#p117771</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117769#p117769" />
			<content type="html"><![CDATA[<p><strong>NuboCoder</strong>, не пойму, а что, по-вашему, делает ваш код ahk?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-03T12:13:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117769#p117769</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117768#p117768" />
			<content type="html"><![CDATA[<p>Мне очень не нравится ссылка тут. Попробуйте так: <br /></p><div class="codebox"><pre><code> url := &quot;http://test-site.ru/myname.php?Text=&quot; . TextVar . &quot;&quot;
URLDownloadToFile, %url%, %a_temp%/s.php</code></pre></div><p>Не уверен что поможет, но так будет правильнее, я думаю.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-08-03T11:03:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117768#p117768</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Кодировка текстовика при передаче на сервер через php]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=117767#p117767" />
			<content type="html"><![CDATA[<p>Доброго времени суток. Столкнулся с такой проблемой..<br />Мне нужно взять текст с файла и отправить его php файлу, который после запишет его в текстовик, лежащий на сервере<br />Код ahk:<br /></p><div class="codebox"><pre><code>FileRead, TextVar, C:\logs\myname.txt
URLDownloadToFile, http://test-site.ru/myname.php?Text=%TextVar%, %a_temp%/s.php</code></pre></div><p>Код php, которому ahk отправляет текст:<br /></p><div class="codebox"><pre><code>&lt;?php 

 $Text = $_GET[&#039;Text&#039;];

 $file = &#039;textfile.txt&#039;;

 $current = file_get_contents($file); 
 $current .= &quot;$Text\n&quot;;

file_put_contents($file, $current); 

 ?&gt;
</code></pre></div><p>В итоге при просмотре файла по адресу http://test-site.ru/textfile.txt вместо русского алфавита видно что-то вроде этого<br /></p><div class="codebox"><pre><code>&quot;������� �������&quot;. </code></pre></div><p>Все 3 файла в кодировке ansi, сколько уже перепробовал, так и не смог ничего сделать, хотя наверняка всё довольно просто. help c:</p>]]></content>
			<author>
				<name><![CDATA[NuboCoder]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34031</uri>
			</author>
			<updated>2017-08-03T10:43:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=117767#p117767</id>
		</entry>
</feed>
