Tk Source Code

View Ticket
Login
Ticket UUID: 1146057
Title: TkAqua: encoding problems with [tk_getOpenFile -filetypes]
Type: Bug Version: obsolete: 8.4.9
Submitter: das Created on: 2005-02-22 08:41:27
Subsystem: 35. [tk_dialog] Assigned To: das
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-02-22 15:46:27
Resolution: Fixed Closed By: das
    Closed on: 2005-02-22 08:45:41
Description:
Problem originally reported by Read Roberts <rroberts@adobe.com>

on TkAqua, tk_get*File uses an incorrect encoding for the -initialfile 
and -filetypes options leading to gibberish displayed in the dialog for 
unicode strings. The example script below shows the problem

#!/bin/sh
#\
exec wish $0 "$@"

set k  [encoding convertfrom utf-8 
"\345\205\250\343\201\246\343\201\256\343\203\225\343\202\241
\343\202\244\343\203\253"]
set t [list [list $k *]]

set d  [file join ~/Desktop $k]
file mkdir $d
close [open [file join $d $k.txt] w]

set f [tk_getOpenFile -title $k -message $k -initialdir $d -initialfile 
$k.txt -filetypes $t]
puts "$f [file exists $f]"

set f [tk_getSaveFile -title $k -message $k -initialdir $d -initialfile 
$k.txt -filetypes $t]
puts "$f [file exists $f]"

set f [tk_chooseDirectory -title $k -message $k -initialdir $d]
puts "$f [file exists $f]"

file delete -force $d
User Comments: das added on 2005-02-22 15:46:27:

File Added - 122268: tkMacOSXDialog-core-8-4-branch.diff

das added on 2005-02-22 15:45:41:

File Added - 122267: tkMacOSXDialog-HEAD.diff

Logged In: YES 
user_id=90580

attached (& committed) patches fix the problem on HEAD and core-8-4-
branch, also corrected potential buffer overrun with -initialdir/-initialfile.

fix made possible through financial support by Adobe.

Attachments: