Open githubniko opened 2 years ago
Are you using an older version of qf/n?
I think we very explicity transmit in iso-8859-1
(latin1
) which is the protocol standard:
~/dev/quickfixn/QuickFIXn$ cat CharEncoding.cs; grep -A5 " Send(" SocketReader.cs SocketInitiatorThread.cs
namespace QuickFix
{
public static class CharEncoding
{
public static System.Text.Encoding DefaultEncoding;
static CharEncoding()
{
DefaultEncoding = System.Text.Encoding.GetEncoding("iso-8859-1");
}
}
}
SocketReader.cs: public int Send(string data)
SocketReader.cs- {
SocketReader.cs- byte[] rawData = CharEncoding.DefaultEncoding.GetBytes(data);
SocketReader.cs- stream_.Write(rawData, 0, rawData.Length);
SocketReader.cs- return rawData.Length;
SocketReader.cs- }
--
SocketInitiatorThread.cs: public bool Send(string data)
SocketInitiatorThread.cs- {
SocketInitiatorThread.cs- byte[] rawData = CharEncoding.DefaultEncoding.GetBytes(data);
SocketInitiatorThread.cs- stream_.Write(rawData, 0, rawData.Length);
SocketInitiatorThread.cs- return true;
SocketInitiatorThread.cs- }
I want the encoding to be taken out to the settings. This will make quick fix more flexible.
"ISO-8859-1" is a standard for English-speaking people. My broker uses win1251 by default and I get a crooked text display and then I have to recode the iso-8859-1 - >win1251, which consumes computing resources.
Now I have edited win1251 encoding in the Char Encoding.cs file and everything has worked for me. Example:
public static class CharEncoding
{
public static System.Text.Encoding Default Encoding;
static Char Encoding()
{
////Default Encoding = System.Text.Encoding.GetEncoding("iso-8859-1");
Default Encoding = System.Text.Encoding.GetEncoding(1251);
}
}
I wouldn't be opposed to exposing it as a SessionSetting. Although the FIX Protocol standard requires latin1, many firms (including very large ones) obviously do not adhere to it.
We faced the same problem with the encoding. Is there any chance to implement this?
There was a commit (https://github.com/connamara/quickfixn/commit/e7d59cea8e46c4f065d4834a4acd171407ea220f)) that implemented that, but this commit (https://github.com/connamara/quickfixn/commit/a75fc7caf0adaf513fabd4aa3378c10797cc7494) reverted back.
Thank you
Can I do something to help on this? I think it's an easy fix and without any danger (if you don't change it, it will work as it is right now).
I said an easy fix because I have in mind that I don't need it per session. We can have a similar approach that QuickFixJ has (see here). A static SetEncoding that we can call one time at the beginning. So the fix will be easy enough.
@gbirchmeier I saw that there is activity lately with a lot of changes. Any change to take a look in this too (see my previous comments)?
We have forked and build our own version just to support a different encoding, so we are stuck without updates.
Thank you
P.S. QuickfixJ current implementation here
Hello. The server transmits FIX messages in windows-1251 encoding. QuickFix writes data to a log file in iso-8859-1. Is it possible to change the encoding without recompiling quickfix/n ?