ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > FARR Plugins and Aliases

Locate32 Plugin for FARR by Okke

<< < (15/25) > >>

jmj:
But I guess that would require locate to be updated, as /? doesn't mention unicode.
-f0dder (December 27, 2007, 10:19 AM)
--- End quote ---

Locate uses Unicode (at least to write console) if databases use Unicode  (you can check this in the settings dialog of locate32.exe).

f0dder:
But I guess that would require locate to be updated, as /? doesn't mention unicode.
-f0dder (December 27, 2007, 10:19 AM)
--- End quote ---

Locate uses Unicode (at least to write console) if databases use Unicode  (you can check this in the settings dialog of locate32.exe).
-jmj (December 27, 2007, 11:33 AM)
--- End quote ---

Oh, okay - then it's probably just the FARR locate plugin that needs updating. Nice to know, should be lots simple to fix :)

Armando: I'm using locate 3.0 build 7.12260, from the x64 build.

losiek:
@lanux128:
Thanks for tips:)


Locate uses Unicode (at least to write console) if databases use Unicode  (you can check this in the settings dialog of locate32.exe).
-jmj (December 27, 2007, 11:33 AM)
--- End quote ---
There is other thing. Locate uses Unicode, but Windows console doesn't. In Windows XP console uses old DOS-style 8-bit codepages to display diacritic characters. In my case (polish language) console uses CP852 codepage and standard windows uses Windows-1250 codepage (or full Unicode). So searching works fine but polish letters are displayed incorrectly in FARR (they have different hex codes in those 2 codepages - thanks to M$) and real Unicode characters (Hebrew, Arabic, Greek etc.) don't work at all. :(

f0dder:
losiek: are you sure about this, also if the *W API forms are used, and a proper console font is selected?

The MSDN entries do sound a bit shoddy, like... WriteConsole being able to handle unicode text, but WriteConsole fails if the console handle is redirected. WriteFile can't write unicode chars to a console buffer, but my guess is that it'll work fine if the standard input is redirected with piping (which is most likely the way the locate plugin works).

So... locate.exe would need to detect if the console handle is a console or redirected, use WriteConsoleW for console handles and WriteFile when redirected.

EDIT: when selecting Lucida Console (instead of a raster font), I was indeed able to get unicode output on a console under WinXP, using the following very quick-and-dirty app. The test was saved with notepad, using the "Unicode" encoding (and editing out the BOM marker). Notice the question marks at the top of the console; I tried the "unitest" application first with a raster font, then switched to lucida console and ran it again.

Apparently windows detects whether the current font supports unicode or not, and doesn't actually output in unicode if it doesn't?
Locate32 Plugin for FARR by Okke

--- Code: C++ ---#define WIN32_LEAN_AND_MEAN#include <windows.h>#include <stdio.h> #define MAXSIZE 4096 int main(){        char    buf[MAXSIZE];        FILE *f = fopen("c:\\test.unicode.txt", "rb");        DWORD   numwritten = 0;        size_t num = fread(buf, 1, MAXSIZE-1, f);        fclose(f);        buf[num] = 0;         WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), buf, num/2, &numwritten, 0);}

losiek:
@f0dder:
Unfortunately I'm not  sure how does this stupid console work :(
I think you are right about redirection detection. Look at http://blogs.msdn.com/junfeng/archive/2004/02/25/79621.aspx. That's exactly the same thing you said:) I used that example in my testapp.

Can you redirect your output to a file (if it'll work at all) and then open it using notepad? In my case displaying using WriteConsoleW and WriteFile works fine but redirection works only with WriteFile (WriteConsoleW gives 0-byte file). But when I open created file with notepad I still get messed Unicode characters :(

I think that Locate should provide option to directly write results to a file (without console and redirection) or simple library interface for searching.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version